MATLAB: Goto command in matlab: Undefined function ‘goto’ for input arguments of type ‘double'”

goto

I am in need of using goto command in matlab. I came to know that there is no goto command in matlab. But there are programs that run using goto command (got from net) where i am getting the output.
Example 1
a = 5;
a = a - 1;
disp(a)
if a > 0
goto(4)
return
end
Example 2
a = 5;
if a == 5
goto(9)
return
else
goto(12)
return
end
disp('a equals five')
goto(13)
return
disp('a does not equal five')
For Example 1 and 2 i'm able to get the output. But when i am using in my program goto(170) i am getting an error "Undefined function 'goto' for input arguments of type 'double'".
Can somebody help me. Thanks in ADVANCE…!

Best Answer

MATLAB does not have a goto function. Use regular functions instead.