MATLAB: Selection of the right VARARGOUT

nargoutvarargoutvariable

Hi, Let's say I have a function called FUN with 4 outputs a,b,c,d, as shown below
[a,b,c,d]=FUN(x)
Then I want to get an answer depending on which output I want, for example, if I enter:
[c]=FUN(x)
I want to get the desired output, NOT just the one on the first column (i.e value of a instead of c).
Thanx

Best Answer

In the new version of MATLAB, you can do [~,~,c]=FUN(x). See this blog http://blogs.mathworks.com/loren/2009/09/11/matlab-release-2009b-best-new-feature-or/
In old version, you have to do [trash, dummy,c]=FUN(x) and then clear trash and dummy.
Whether it allows you to have three outputs rather than the full four outputs will depend on how FUN(x) is written.