Hi All
I want to ask question in matlab, Can I create if loop inside for loop such that if on condition of if hold then for loop must end, i.e How can we do the following
For i = 1:2:10
if mod(i,2)=0
end
else
i
end
Hi All
I want to ask question in matlab, Can I create if loop inside for loop such that if on condition of if hold then for loop must end, i.e How can we do the following
For i = 1:2:10
if mod(i,2)=0
end
else
i
end
Best wishes
The correct program should read:
Code:
for i=1:2:10
if mod(i,2)==0
break
else
i
end
end
Last edited by CaptainBlack; Jan 4th 2011 at 03:58 AM.
Reason: added code block and indentation