Filter löschen
Filter löschen

convert for loop to while

6 Ansichten (letzte 30 Tage)
sam ham
sam ham am 9 Nov. 2016
Beantwortet: Adam am 9 Nov. 2016
Can someone help me convert this for loop to a while loop?
v=0;
for n=1:length(i);
v=v+i(n);
end

Antworten (1)

Adam
Adam am 9 Nov. 2016
v = 0;
n = 1;
while n <= length( i )
v = v + i( n );
n = n + 1;
end
Quite why you would want to do this I don't know but anyway...

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!

Translated by