Question: USING MATLAB: 2. Given a file containing test scores, one per line, we want to have a new file that contains the scores in increasing
USING MATLAB:
2. Given a file containing test scores, one per line, we want to have a new file that contains the scores in increasing order. To do this, write a MATLAB script (hw5b.m) that asks the user for two file name strings, one for the input scores and the second for the output, sorted scores. The program should open the first file (to read), read the scores, sort them, open the second file (to write), and output to this file the scores in increasing order. There should be one score per line, with their line number from the input file. As an example, suppose the input file is scores.txt and it contains 75 98 75 100 21 83 15 then running your program should look like the following: Enter the scores file: scores.txt scores.txt Enter the output file: scores_sorted.txt scores sorted.txt When you look at the contents of scores_sorted.txt you should see 8: 15 5: 21 6: 66 1: 75 3: 75 7: 83 2: 98 4: 100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
