I am new to matlab in this assignment I have to give In an assignment an average for a gradebook and the assign a letter grade to each.
This is the error message I receive: In an assignment A(:) = B, the number of elements in A and B must be the same.
Code:
display(gradebook);
A = table2array(gradebook);
loopend = size(A,1)
for i=1:loopend
average(i) = mean(A(i,1:5));
end
for i=1:loopend
if (average(i) <= 59)
letter(i) = 'E' ;
elseif (average(i) <= 69)
letter(i) = 'D' ;
elseif (average(i) <= 79)
letter(i) = 'C' ;
elseif (average(i) <= 85)
**letter(i) = 'C+' ;**
elseif (average(i) <= 89)
**letter(i) = 'B+' ;**
elseif (average(i) <= 100)
letter(i) = 'A' ;
end
end
display(letter)
The problem arises in the fact that I want to have a C+ and B+, It only accepts 1 character within the ''. Is there a way to fix this?