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; endendfor 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); endendfprintf('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));endfor n = let(1):let(l) fprintf('Vl(%d) = %d \n',n,Vl(n));endOutputM(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.
MATLAB: Index exeeds matrix dimensions
arraymatrix array
Best Answer