Function Output selection help?

7 visualizzazioni (ultimi 30 giorni)
Steve
Steve il 8 Ott 2011
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.

Risposta accettata

Wayne King
Wayne King il 8 Ott 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 Commenti
Jan
Jan il 8 Ott 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
Walter Roberson il 8 Ott 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by