Can';我不明白这个MatLab错误告诉了我什么

Can';我不明白这个MatLab错误告诉了我什么,matlab,Matlab,因此,我这里有一段代码,它试图加载一个excel文件中的考试成绩,这是一组35x5的数据,并计算每个学生的平均考试分数(35个学生,每个学生5次考试)。然后,它应该根据每个学生的平均分数,吐出每个学生的字母分数 %65 P %Penna Garrett %Exam Grades part 2 %Loading the Exam Scores from Excell grades = xlsread ('Exam_Grades_Data_Part2') %Don't need to do

因此,我这里有一段代码,它试图加载一个excel文件中的考试成绩,这是一组35x5的数据,并计算每个学生的平均考试分数(35个学生,每个学生5次考试)。然后,它应该根据每个学生的平均分数,吐出每个学生的字母分数

%65    P
%Penna Garrett

%Exam Grades part 2

%Loading the Exam Scores from Excell
grades = xlsread ('Exam_Grades_Data_Part2')
%Don't need to do display because xlsread throws it into command window


%Letter grade earned based on this scale of average test scores:
%0-59 = E
%60-69 = D
%70-75 = C
%76-79 = C+
%80-85 = B
%86-89 = B+
%90-100 = A

%To Calculate the average for all rows I will use a loop function
temp = size(grades)

%Here is my 'for' function
loopend = size(grades,1)

for i=1: loopend
    average(i) = mean(grades(i,1:5));

    if (average(i) <= 59)
        letter{i} = 'E' ;
    elseif (average(i) <= 69)
        letter{i} = 'D' ;
    elseif (average(i) <= 75)
        letter{i} = 'C' ;
    elseif (average(i) <= 79)
        letter{i} = 'C+' ;
    elseif (average(i) <= 85)
        letter{i} = 'B' ;
    elseif (average(i) <= 89)
        letter{i} = 'B+' ;
    elseif (89 < average(i) <= 100)
        letter{i} = 'A' ;
    end
end


display('Hopefully you have recieved the grade you wanted. If not, I may see you next year! Dr. P')
display (letter)
%65 P
%佩纳·加勒特
%考试成绩第二部分
%从Excell加载考试分数
等级=xlsread('考试成绩数据部分2')
%不需要进行显示,因为xlsread将其抛出到命令窗口中
%基于此平均考试分数表获得的字母分数:
%0-59=E
%60-69=D
%70-75=摄氏度
%76-79=C+
%80-85=B
%86-89=B+
%90-100=A
%要计算所有行的平均值,我将使用循环函数
温度=尺寸(等级)
%这是我的“for”函数
loopend=尺寸(等级,1)
对于i=1:loopend
平均值(i)=平均值(等级(i,1:5));
如果(average(i)您可能在工作区中将变量“letter”作为非单元数据类型(如double)存在。您可能应该在for循环上方的某个位置将该变量初始化为单元

letter = {};