Simple explanation - how to use varargout
Show older comments
Can anyone give me a simple example of how to use the varargout function? I can't seem to get it to work. The code I've tried looks like this:
[varargout]=fxn_name(x)
if condition, varargout(1)={P}, end
if condition 2, varargout(2)={Q}, end
I tried the above code and the output is always the last calculation that was made in the function file. (ex. the output is ans=N, if N was the last value to be evaluated in the function file).
I've tried reading some of the examples on the web but I can't make heads or tails out of them. Thanks for any help.
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!