how to write function with indefinite number of outputs?

1 view (last 30 days)
I know how to write function of one or multiple outputs. But there are lots of function in MATLAB which can be used with one and multiple outputs also. How to handle such feature?

Accepted Answer

Walter Roberson
Walter Roberson on 13 Sep 2015
You check nargout to see how many outputs there are, and you make assignments to varargout{K} for the K'th output.

More Answers (0)

Categories

Find more on Argument Definitions in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!