how to write function with indefinite number of outputs?

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

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!