Function Output selection help?
5 views (last 30 days)
Show older comments
Hello Experts,
I have a function func. I know that func can give me [output1,output2] and by default gives me the output1.
How can I customize it and ask Matlab to give me the second output.
I will appreciate if you will give me the way to toggle between the outputs.
Thanks in advance.
0 Comments
Accepted Answer
Wayne King
on 8 Oct 2011
If you define the function to give [output1,output2], then you can call the function
[~,output2] = func( )
and it will not output output1
5 Comments
Jan
on 8 Oct 2011
~ is either the not-operator, or in the case of inputs and outputs the command to ignore the argument.
This method does not work with Matlab versions before 2009b.
You've asked several very basic questions in the last 10 days. I suggest to read the Getting Started chapters in the documentation. If Google can answer a question, it is not efficient to ask in this forum
This forum is very mindful and you can be sure that your blog has been registered already.
Walter Roberson
on 8 Oct 2011
The technical name of "~" is "tilde". But of course, a pedant would point out that "~" as used in MATLAB is not correct, and that one should instead use "∼" (U+223C) TILDE OPERATOR, for logical negation, and possibly "⁓" (U+2053) SWUNG DASH, for indicating omission. And if you can tell the difference between those characters, you have better eyes than I do!
http://en.wikipedia.org/wiki/Tilde
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!