"jump" in a 'for' cycle
Hi, to put it simply I need to "jump" in a 'for' cycle. For a better understanding an exmaple always helps
When the variable 'i' has the value of 10 I need to "jump" two rows with the 'i' index and countinue again with an increment of 1. I don't know why this code doesn't work.
Could someone help me with this issue please ?
Thanks in advance !
clear all; j = 1; for i = 1:20 result(j,1) = i; % this is just for storing of the variable 'i' that is involved in the first "for" cycle j = j + 1; % adding another row for the variable "result" if i == 10 i = i+2; end end
When the variable 'i' has the value of 10 I need to "jump" two rows with the 'i' index and countinue again with an increment of 1. I don't know why this code doesn't work.
Could someone help me with this issue please ?
Thanks in advance !
0
Comments
I've tried the same thing in C# and it worked perfectly
What language is this?
If it's any help this is as it should look in C#
I don't really think it will but I shan't know till I try
can you give an example of an output "result" array that you want to see?