The size of the indicated variable or array appears to be changing with each loop iteration
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
vishnuvardhan naidu tanga
am 10 Dez. 2019
Beantwortet: JESUS DAVID ARIZA ROYETH
am 10 Dez. 2019
hello, i am trying to model an iteration loop in matlab, and i am getting the following error 'The size of the indicated variable or array appears to be changing with each loop iteration'. is there a way to solve it?
mz code is:
for i = 2:n
CR = (P_out/P_in)^(1/(i+1));
P(1) = P_in;
P(i) = CR*P(i-1);
P(i+1) = CR*P(i);
end
0 Kommentare
Akzeptierte Antwort
JESUS DAVID ARIZA ROYETH
am 10 Dez. 2019
P=zeros(1,n+1);
P(1) = P_in;
for i = 2:n
CR = (P_out/P_in)^(1/(i+1));
P(i) = CR*P(i-1);
P(i+1) = CR*P(i);
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!