MATLAB: Exiting if condition and for loop

control flow

for i=1:100
if condition operations;
else
continue
end
end
here continue will exit out of the if loop but thing is that if else statement executed it should come out of for loop. how can i do that

Best Answer

Try
for i=1:100
if condition
operations;
else
break
end
end