Index exeeds matrix dimensions
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hariharan ilango
am 17 Feb. 2017
Kommentiert: hariharan ilango
am 17 Feb. 2017
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
Akzeptierte Antwort
Walter Roberson
am 17 Feb. 2017
for n = 1:h
not
for n = hst(1):hst(h)
and likewise
for n = 1 : l
not
for n = let(1):let(l)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multicore Processor Targets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!