help-octave
[Top][All Lists]
Advanced

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

Re: Converting a list to input variables for a function using varargin.


From: Ben Abbott
Subject: Re: Converting a list to input variables for a function using varargin.
Date: Sun, 16 Sep 2012 09:06:49 -0400

On Sep 16, 2012, at 8:25 AM, Jose <address@hidden> wrote:

> Hello.
> 
> Suppose that I have a function accepting a variable number of input arguments.
> function myfunct(a,b,varagrin)
> Then suppose that I have the arguments corresponding to varagrin in a list 
> already. How can I call myfunct?

Placing {:} at the end of your list (a cell array I assume) effectively returns 
the contents separated by commas (a cs-list).

Thus, if your list contains four elements, the following ...

myfunct (a, b, your_list{:})

... is equivalent to ... 

myfunct (a, b, your_list{1}, your_list{2}, your_list{3}, your_list{4})

Ben


reply via email to

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