From: jeremy meduna on
Got this so far:
fh = fopen('grades.txt', 'r');
line = '';
while ischar(line)
[first line] = fgetl(fh)
scores = sscanf(line, '%f %f %f %f %f');
GPA= scores(1:end)/length(scores)
end
xlswrite('grades.xls');
fclose(fh);




"jeremy meduna" <jeremymeduna(a)msn.com> wrote in message <hob53g$oo2$1(a)fred.mathworks.com>...
> A text file named "grades.txt" contains students names and grades in the following format:
> John Doe
> A A B B C
> Jane Doe
> C D C B A A
> Jill Doe
> C D F F
>
> Write a matlab script that reads the file, calculates the GPA for each student and save the fist name, last name and GPA to an excel file "gpa.xls"
>
> So far all I can come up with is:
>
> fh = fopen('grades.txt', 'r');
> line = '';
> while ischar(line)
> [first line] = fgetl(fh)
>
> Completely unsure on how to do this. Having lots of trouble in this class, would appreciate any help!