Index exeeds matrix dimensions
Show older comments
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 Comments
KSSV
on 17 Feb 2017
We cannot help you unless variables inside are known to us..
hariharan ilango
on 17 Feb 2017
hariharan ilango
on 17 Feb 2017
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!