PDA

View Full Version : MATLAB question


Jamin2112
Jun10-11, 03:20 PM
So I'm trying to make an M-file that takes all the credits and GPA's from every member in my fraternity (I'll type them in manually), then does a bunch of calculations on them.

So far I've created a vector of structures, each structure referring to a person in the house. Each structure will have a field called "name" so that I know where to input each person's GPA once grades are released. Anyways, you might be able to tell from below. I'm trying to figure out how to input each person credits and GPA. I just put a little example of what I'm trying to do for one person on rows 12 and 13. However, it isn't working. Could I get some help?


http://i701.photobucket.com/albums/ww13/jamin2112/screen-capture-41.png

MATLABdude
Jun10-11, 09:46 PM
Manual data entry isn't exactly MATLAB's forte: if you use Excel and save as a .csv (comma separated values) or just a plain jane .xls or .xlsx, it'd be a whole lot easier and more portable. Actually, for what you're trying to do (basic stats), you can probably do it all in Excel.

That said, once you've got an Excel spreadsheet (or a .csv) you can import it into MATLAB if you're doing fancier stuff using a variety of functions:
http://www.mathworks.com/help/techdoc/import_export/br5s7ig.html

Also for future reference, put your code between [code] and [ /code] tags (no space in the second tag) to keep formatting and make things pretty, instead of using a screen grab.