Question
Matlab Use the given variables... %load the binary file containging the data %The syntax is just load filename, NOT varname = load('filename') %There should now
Matlab
Use the given variables...
%load the binary file containging the data %The syntax is just load filename, NOT varname = load('filename')
%There should now be a matrix called scores and a string array called names
disp(scores) disp(names)
%open an output file for write access
%print the contents of the file, including title & headers
%loop over the students, printing out each student's name & scores on one line. %DO NOT HARD-CODE THE NUMBER OF STUDENTS - use a MATLAB built-in function to %determine how many students there are.
%Don't forget to close the file!
%read the file into a char array; don't terminate this line with a semicolon so %the file contents will be displayed to the screen
fileContents = [] %complete this line
You are provided with some students' test scores in a binary file, and you want to write them to an ASCII file in an easy-to-read format. 1. load the file test scores.mat, which contains a matrix called scores containing the students' scores and a string array containing the names of the students. 2. Write a text file fin a nicely formatted table using fprintf (like the table shown below). The name of the text file may be anything that you like. The table should have an appropriate and clear title. Create column headers and label each row. Once the file is created, use the command fileread read the contents of the file into a character array called fileContents. Hint: You must use fopen, fprintf, and fclose. You want to embed the student's name followed by format conversion characters for each test score for each student. Test Scores Student Test 1 Test 2 Test 3 Test 4 Tests Jim Judy 71 Pat 70 84 83 82 98 90 100 100 100 95 90 85 95 78Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started