Index exeeds matrix dimensions
显示 更早的评论
for n = 1:k
%HS or LE
prompt = 'Enter individual tasks memory location \n High Speed = 1 \n Low Energy = 0 \n';
fprintf('M(%d) = \n',n);
M(n) = input (prompt);
if M(n) == 1
h = h+1;
prompt = 'Enter the hiding value of high speed tasks \n';
fprintf('V(%d) = \n',h);
Vh(h) = input (prompt);
hst(h) = n;
else
l = l+1;
prompt = 'Enter the hiding value of low speed tasks \n';
fprintf('V(%d) = \n',l);
Vl(l) = input (prompt);
let(l) = n;
end
end
for n = 1:k
if M(n) == 1
a = 'High speed';
fprintf('M(%d) = %s \n',n,a);
else
b = 'Low Energy';
fprintf('M(%d) = %s \n',n,b);
end
end
fprintf('Number of High speed tasks = %d \n',h);
fprintf('Number of Low Energy tasks = %d \n',l);
for n = hst(1):hst(h)
fprintf('Vh(%d) = %d \n',n,Vh(n));
end
for n = let(1):let(l)
fprintf('Vl(%d) = %d \n',n,Vl(n));
end
Output
M(1) = High speed
M(2) = High speed
M(3) = High speed
M(4) = High speed
M(5) = Low Energy
M(6) = Low Energy
M(7) = Low Energy
Number of High speed tasks = 4
Number of Low Energy tasks = 3
Vh(1) = -100
Vh(2) = -1
Vh(3) = -2
Vh(4) = -3
Index exceeds matrix dimensions.
3 个评论
KSSV
2017-2-17
We cannot help you unless variables inside are known to us..
hariharan ilango
2017-2-17
hariharan ilango
2017-2-17
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!