In Matlab, you can return multiple values from a function by separating them with commas. If you only want to use one the output variables, you can use the tilde (~) character to indicate that you don't intend to use that value. Here is an example function that returns three outputs but only the first is used:
main.m188 chars7 lines
To use only the first output, you can call the function and assign the outputs like this:
main.m120 chars3 lines
Alternatively, you can use the tilde to indicate that you don't care about the other outputs:
main.m81 chars2 lines
Note that using the tilde character can be useful if you want to ignore some outputs but still want to maintain the correct number of output arguments.
gistlibby LogSnag