Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to detect when a output argument was marked unused with ~(tilde)?
Replies: 6   Last Post: Oct 21, 2013 2:00 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 8,802
Registered: 7/26/08
Re: How to detect when a output argument was marked unused with ~(tilde)?
Posted: Jan 11, 2013 2:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.