Creating an M-file for Fraternity GPA Calculations with MATLAB

  • MATLAB
  • Thread starter Jamin2112
  • Start date
  • Tags
    Matlab
In summary, the speaker is seeking help with creating an M-file that can perform calculations on the credits and GPA's of members in their fraternity. They have created a vector of structures for each person and are trying to figure out how to input the data. The suggestion is made to use Excel for easier data entry and the option to import it into MATLAB for more advanced functions. The speaker also advises using [code] tags for formatting instead of screen grabs in the future.
  • #1
Jamin2112
986
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
  • #2
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:

Related to Creating an M-file for Fraternity GPA Calculations with MATLAB

1. What is an M-file and how is it used for fraternity GPA calculations?

An M-file is a text file in MATLAB that contains a series of commands and functions. It can be used to write and run custom programs for specific calculations, such as fraternity GPA calculations. By writing an M-file, you can streamline the process of calculating GPAs for multiple students.

2. How do I create an M-file for fraternity GPA calculations?

To create an M-file for fraternity GPA calculations, you first need to open the MATLAB Editor. Then, you can write your code using the appropriate functions and syntax. Once you have written your code, save the file with the extension ".m" and it will be ready to use for GPA calculations.

3. Can I customize the M-file for my specific fraternity's grading system?

Yes, the beauty of using an M-file for GPA calculations is that you can customize it to fit your specific fraternity's grading system. By using functions and variables, you can input different weightings for letter grades and calculate the GPA accordingly.

4. Is it possible to calculate GPAs for multiple students at once using an M-file?

Yes, using an M-file allows you to calculate GPAs for multiple students at once. You can write your code to read in a list of student names and corresponding grades, and then loop through the calculations for each student. This can save a significant amount of time and effort compared to manually calculating GPAs for each student.

5. Are there any resources available to help me create an M-file for fraternity GPA calculations?

Yes, there are many resources available to help you create an M-file for fraternity GPA calculations. The MATLAB documentation provides a comprehensive guide on functions and syntax, and there are also online tutorials and forums where you can find helpful tips and advice from other users. Additionally, your fraternity may have specific resources or guidelines for calculating GPAs that you can incorporate into your M-file.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top