"Max Brega" wrote in message <firstname.lastname@example.org>... > 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.