matlab问题,很急啊!!关于其中出现的越界错误,求如何解决~~~
isWeight=1;score=[152.4580100];if~exist('C1','var')||isempty(C1)C1=xlsread('校赛A素材.xls...
isWeight = 1;
score = [1 52.45 80 100];
if ~exist('C1', 'var') || isempty(C1)
C1 = xlsread('校赛A素材.xls', 'B2:P96');
end
if~exist('C2', 'var') || isempty(C2)
C2 = xlsread('校赛A素材.xls ', 'Q2:U96');
for i = 1 : size(C2, 1)
for j = 1 : size(C2, 2)
if C2(i, j) ~= 0
C2(i, j) = score(C2(i, j));
end
end
end
C = [C1 C2];
error = [];
for i = 1 : size(C, 1)
for j = 1 : size(C, 2)
if C(i, j) ~= 0 && C(i, j) < 57
error = [error i];
break;
end
end
end
end
ifisWeight == 1
SumScore = zeros(size(C2, 1),1);
temp = sum(C(:, 1:20) .*repmat(P(1, 1:20), size(C, 1), 1), 2);
for i = 1 : size(C, 1)
for j = 1 : size(C(1:20), 2)
SumScore(i) = SumScore(i) + P(j) *Step(C(i, j));
end
SumScore(i) = temp(i) /SumScore(i);
end
temp = sortrows([[1:1:95]'SumScore], -2);
disp('学分加权成绩排名');
disp(temp(1:10, :));
end
老是出现
??? Index exceeds matrix dimensions.
问题,求解答 展开
score = [1 52.45 80 100];
if ~exist('C1', 'var') || isempty(C1)
C1 = xlsread('校赛A素材.xls', 'B2:P96');
end
if~exist('C2', 'var') || isempty(C2)
C2 = xlsread('校赛A素材.xls ', 'Q2:U96');
for i = 1 : size(C2, 1)
for j = 1 : size(C2, 2)
if C2(i, j) ~= 0
C2(i, j) = score(C2(i, j));
end
end
end
C = [C1 C2];
error = [];
for i = 1 : size(C, 1)
for j = 1 : size(C, 2)
if C(i, j) ~= 0 && C(i, j) < 57
error = [error i];
break;
end
end
end
end
ifisWeight == 1
SumScore = zeros(size(C2, 1),1);
temp = sum(C(:, 1:20) .*repmat(P(1, 1:20), size(C, 1), 1), 2);
for i = 1 : size(C, 1)
for j = 1 : size(C(1:20), 2)
SumScore(i) = SumScore(i) + P(j) *Step(C(i, j));
end
SumScore(i) = temp(i) /SumScore(i);
end
temp = sortrows([[1:1:95]'SumScore], -2);
disp('学分加权成绩排名');
disp(temp(1:10, :));
end
老是出现
??? Index exceeds matrix dimensions.
问题,求解答 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询