matlab

s_43 = ones(1,128);
s_43(1,:) = 36.3;
% 31.2	32.5	36.3

for i = 1:128
    if(z(i)==2)
        s_43(i) = s_43(i).*0.9;
    else if(z(i)==3)
            s_43(i) = s_43(i)*0.8;
        else if(z(i)<=6&&z(i)>=4)
                s_43(i) = s_43(i)*0.7;
            else if(z(i)>6)
                s_43(i) = s_43(i)*0.6;
                end
            end
        end
    end
end
StudentName = categorical(StudentName);
A2 = unique(StudentName); 
z = hist(StudentName, A2);
z4 = ones(1,128);
for i = 1:128
    z4(i) = s_41(i)+s_42(i)+s_43(i);
end
x = 1:128;
bar(x,z4);
i = 1;
for a = 1:length(CS3(:))/2
    if(LastTime(i,1)==CS3(a,1))   % 判断学生是否为同一人
        LastTime(i,4)=CS3(a,2);   % 将第几题的时间赋值给LastTime
    else
        i = i+1;    % 若不是该学生,说明是下一个学生
        LastTime(i,4)=CS3(a,2);   % 将第几题的时间赋值给LastTime
    end
end
%创建一个128行6列的矩阵,将第一列赋值
LastTime = ones(128,4)
LastTime = string(LastTime)
LastTime(:,1) = A2
%创建一个128行6列的矩阵,将第一列赋值
ls = ones(128,4)
s = 0.161  %转换后的权重
for i=1:128
    ls(i,4) = z(i)*s;
end
StudentName = categorical(CS3(:,1));    % 统一格式化
A2 = unique(StudentName);   % 取出每一个单独的
[z,y] = hist(StudentName, A2);  % 输出z,y
t43 = ones(length(z),3);    %根据z与y构建矩阵
t43 = string(t43);  %将数值矩阵转化为字符串矩阵
t43(:,1) = string(y);   %将序号赋值
t43(:,2) = string(z);   %将提交次数赋值
t43(:,3) = "N";         %将是否迟交钱赋值为N
for i = 1:length(CS3(:,1))  %判断迟交学生编号
    if(CS3(i,2)=="Y")
        [m,n] = find(t43==CS3(i,1));
        t43(m,3) = "Y";
    end
end
posted @ 2022-05-04 22:47  又一岁荣枯  阅读(157)  评论(0编辑  收藏  举报