convert for loop to while
1 view (last 30 days)
Show older comments
Can someone help me convert this for loop to a while loop?
v=0;
for n=1:length(i);
v=v+i(n);
end
0 Comments
Answers (1)
Adam
on 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...
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!