Creating an M-file for Fraternity GPA Calculations with MATLAB

  • Topic: MATLAB 
  • Thread starter Thread starter Jamin2112
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
1 reply · 2K views
Jamin2112
Messages
973
Reaction score
12
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?


screen-capture-41.png
 
Physics news on Phys.org
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.
 
Last edited by a moderator: