Function Output selection help?

조회 수: 7 (최근 30일)
Steve
Steve 2011년 10월 8일
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에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by