MATLAB: An equivalent to jump/goto

go togotojump

Hello all,
I would like to jump between my loops whole/for. I know that I can use the command break, but it doesn't work in this situation.
There is the architecture of my code :
while (condition1)
Action1
while (Condition2)
Action2
for i=1:N
if (Condition3)
Action3
%Goto second While loop
elseif (Condition4)
Action4
%Goto first While loop
end
end
end
end
Is it possible to do these 'Goto' with Matlab ? or an equivalent ?
Thanks.

Best Answer

The MATLAB equivalent is to use functions that you call when you want to go somewhere else.
This is explained in the documentation for function, available here: