Question: The attached text data file, MATRAX.dat, contains the following student exam data: Name E2 Apple, A. Exxon, E. Facebook, F. Google, G. Ibm, I.
The attached text data file, MATRAX.dat, contains the following student exam data: Name E2 Apple, A. Exxon, E. Facebook, F. Google, G. Ibm, I. Microsoft, M. Twitter, T. net ID a5123 e1567 f2321 93455 14678 m2134 t5321 Name Apple, A. Ibm, I. Google, G. Twitter, T. Facebook, F. Microsoft, M. Exxon, E. E1 85 20 A. Open this file using fopen, skip over the two header lines using fgetl, and use a single fscanf command to read the three numerical columns into a 7x3 matrix of grades, say G. Rewind but do not close the file. 68 85 86 55 70 B. Then, use a single textscan command to read from the file the two text columns N, I, of student names and netIDs, each being a 7x1 cell array of strings. You may now close the opened file. netID a5123 14678 C. Using the function mean, compute the averages of the three exams for each student. The resulting column vector will be entered under the column labeled AVE in the above table. Enlarge the matrix G by appending to it the column AVE of averages. Then, compute the averages of each column, i.e., the average of each exam for the entire class, including the overall average for all exams and for all students. 93455 t5321 f2321 m2134 e1567 100 58 45 87 88 47 65 D. Using the function sortrows, sort the exam grades according the column AVE of averages, in descending order. Then, open a new data file, say, MATRAX2.dat, and using fprintf, write into it the sorted data including the original header lines and the computed averages. You may use a for-loop for printing the table data. The contents of this file should be as follows: exam_AV E2 90 65 92 90 89 59 72 E1 E2 I AVE I I E2 85 100 86 88 85 87 90 70 65 72 68 45 92 55 47 59 20 58 65 67.00 70.00 79.57 90 89 I AVE | 91.67 | 87.67 | 87.33 | 69.00 | 68.33 | 53.67 | 47.67 | 72.19 Upload the new data file with your recitation report. Repeat this part using at most five fprintf commands (no for-loops).
Step by Step Solution
3.54 Rating (161 Votes )
There are 3 Steps involved in it
Heres the MATLAB code to solve the problem with explanations for each part A Reading Grades into Matrix Matlab fid fopenMATRAXdat r Open file for read... View full answer
Get step-by-step solutions from verified subject matter experts
