Index exeeds matrix dimensions
Ältere Kommentare anzeigen
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 Kommentare
KSSV
am 17 Feb. 2017
We cannot help you unless variables inside are known to us..
hariharan ilango
am 17 Feb. 2017
hariharan ilango
am 17 Feb. 2017
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!