help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use varargout?


From: Terry Duell
Subject: Re: How to use varargout?
Date: Fri, 08 Aug 2014 15:55:17 +1000
User-agent: Opera Mail/12.16 (Linux)

Greatcoats off!
I have found a way to do it...see below.

On Fri, 08 Aug 2014 14:25:11 +1000, Terry Duell <address@hidden> wrote:

Hello All,
I want my function to have a variable number of output parameters, and it looks as though one must use sequential parameters, and not 1,3,4,6 for example.
To illustrate what I mean, say my function is...
  function varargout = myfunc(a,b,c)
% outputs can be [a1, a2, a3, a4, a5, a6]
% where a1 = ...
%           a2 = ...
if nargout == 1
   stuff = a1
else
   otherstuff = a2
etc

so, is it possible to call myfunc as follows;
[b1,,b3,,b5] = myfunc(a,b,c)
where I'm looking to output a1, a3, and a5 only?

the call would be...

[b1,~,b3,~,b5] = myfunc(a,b,c)

Cheers,
--
Regards,
Terry Duell



reply via email to

[Prev in Thread] Current Thread [Next in Thread]