
4 Programming
In this sequence the statements b etween try an d catch are executed until
an error occurs. The statements between
catch and end are then executed.
Use
lasterr to see the cause of the error. If an error occurs between catch
and end, MATLAB terminates execution unless another try-catch sequence
has b een established.
Program Termination – return
This section covers the MATLAB retu rn function that enables you to
terminate your p rogram befo re it runs to completion.
return
return terminates the current sequence of commands and returns control to
the invoking function or to the k eyboard.
return is also used to terminate
keyboard mode. A called function normally transfers control to the function
that invoked it when it reaches the end of the function. You can insert a
return statement within the called function to force an early termination and
to transfer control to the invoking function.
4-8
Commentaires sur ces manuels