Creating an M-file for Fraternity GPA Calculations with MATLAB

  • Context: MATLAB 
  • Thread starter Thread starter Jamin2112
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

This discussion focuses on creating an M-file in MATLAB for calculating fraternity GPAs based on manually entered data. The user has developed a vector of structures to represent each fraternity member, with fields for names and GPAs. However, manual data entry is inefficient, and it is recommended to use Excel to manage the data, saving it as a .csv or .xls file for easier import into MATLAB. The MathWorks documentation provides guidance on importing data into MATLAB for further analysis.

PREREQUISITES
  • Familiarity with MATLAB programming and M-files
  • Understanding of data structures in MATLAB
  • Basic knowledge of Excel for data management
  • Experience with importing data into MATLAB
NEXT STEPS
  • Learn how to create and manipulate vectors of structures in MATLAB
  • Explore MATLAB's data import functions, such as readtable and csvread
  • Study how to perform statistical calculations in MATLAB
  • Investigate best practices for data organization in Excel for MATLAB integration
USEFUL FOR

This discussion is beneficial for MATLAB users, fraternity members managing GPA calculations, and anyone interested in integrating Excel data with MATLAB for statistical analysis.

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:

Similar threads

  • · Replies 4 ·
Replies
4
Views
10K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
1
Views
4K
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 5 ·
Replies
5
Views
9K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K