https://www.mathworks.com/help/releases/R2018b/matlab/ref/nargout.html
nargout
Number of function output arguments
Syntax
nargout-
Description
nargoutreturns the number of function output arguments specified in the call to the currently executing function. Use this syntax in the body of a function only.nargout([fun](https://www.mathworks.com/help/releases/R2018b/matlab/ref/nargout.html#bsyib3_-1-fun))returns the number of outputs that appear in thefunfunction definition. If the function includesvarargoutin its definition, thennargoutreturns the negative of the number of outputs. For example, if functionmyFundeclares outputsy,z, andvarargout, thennargout('myFun')returns-3.
