Assigning letter grades code

5 Ansichten (letzte 30 Tage)
Not_sharpest_tool.mat
Not_sharpest_tool.mat am 14 Okt. 2018
Beantwortet: Cris LaPierre am 15 Okt. 2018
Hello, I'm trying to do an assignment that has to calculate mean and assign letter grades to grades from an excel document. I've successfully got the mean but I cant get the letter grade part to work. Any suggestions?
endgradebook = xlsread('E');
display (gradebook)
for i=1:95
average(i)= mean(gradebook(i,1:5));
end
display(average)
for i=1:95
average(i)=mean(gradebook(i,1:5);
if(average(i)<=59)
letter{i}= 'F';
elseif(average(i)<=69)
letter{i}= 'D';
elseif(average(i)<=79)
letter{i}= 'C';
elseif(average(i)<=89)
letter{i}= 'B';
else
letter{i}= 'A';
end
end
  3 Kommentare
Not_sharpest_tool.mat
Not_sharpest_tool.mat am 14 Okt. 2018
Thanks, the problem was the second mean calculation. I erased it and it worked.
Walter Roberson
Walter Roberson am 14 Okt. 2018
Should not have made a difference, it was just repeating what had already been calculated.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Cris LaPierre
Cris LaPierre am 15 Okt. 2018
Your second calculation of mean is missing a closing parentheses, though that may just be a copy/paste error.
...
for i=1:95
average(i)=mean(gradebook(i,1:5);
...

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by