|
Re: How to detect when a output argument was marked unused with ~(tilde)?
Posted:
Jan 11, 2013 2:05 PM
|
|
"Max Brega" wrote in message <kcpn88$54u$1@newscl01ah.mathworks.com>... > Hello, > > we have recently seen the introduction of the new syntax to ignore some outputs of a function, i.e. [a,~,c]=function(arg1,arg2,arg3) will ignore the second output and just store the other two outputs in 'a' and 'c'. > > I am writing a function in which calculating one output takes a lot of time, and if the user has called that function marking with ~ a certain output variable, it is pretty silly to spend a lot of execution time to compute something that will be certainly discarded. > > So my question is: > is there a way to check from inside the function, whether or not a certain output variable was marked "unused" with ~ ?
Why not reorder the output by priority order, then use nargout to check how many output arguments are requested.
Bruno
|
|