Question: For MATLAB PROGRAMMING Patwts-1.dat 1. Ch9-Variation on #14 For a biomedical experiment, the names and weights of some patients have been stored in a file
1. Ch9-Variation on #14 For a biomedical experiment, the names and weights of some patients have been stored in a file patwts.dat. For example, the file might look like this Darby George 166.4 Helen Dee 143.2 Giovanni Lupa 192.1 Anne Cha 155.1 Create this data file first. Then, write a script readpatwts that will first attempt to open the file. If the file open is not successful, an error message should be printed. If it is successful, the script will read the data into strings, one line at a time. Print for each person the name in the form 'last,first followed by the weight. Also, calculate and print the total weight and the average weight. Finally print whether or not the file close was successful. For example, the result of running the script would look like this: >> readpatwts George, Darby 166.4 Dee, Helen 143.2 Lupa, Giovanni 192.1 Cha, Anne 155.1 The total weight is 656.8 The average weight is 164 .2 File close successful
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
