Function Output selection help?

10 次查看(过去 30 天)
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.

采纳的回答

Wayne King
Wayne King 2011-10-8
If you define the function to give [output1,output2], then you can call the function
[~,output2] = func( )
and it will not output output1
  5 个评论
Jan
Jan 2011-10-8
~ 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
Walter Roberson 2011-10-8
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by