Newbie: The variable (k) of the for loop inside a while
17 views (last 30 days)
Show older comments
I have been programming for a short time with matlab and I have a question regarding this code:
while Voltage(k-11)<Voltage(k-10) && Voltage(k-11)<27
The question is: The variable k, once has been increased during the while, when the condition of the while doesn't meet anymore, and it goes to the for loop again, the value of k remains the same before having been increased during the while loop or does it remain updated after the while?
Iain on 17 Jul 2013
At the start/end of each for loop, the loop variable is reset to the next value.
for i = 1:5
i = i + 1;
More Answers (0)
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!