The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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: 9,822
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$>...
> 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.


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.