help-octave
[Top][All Lists]
Advanced

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

Re: Strange syntax


From: bigmealy
Subject: Re: Strange syntax
Date: Wed, 28 Nov 2012 03:20:28 -0800 (PST)

Juan Pablo Carbajal-2 wrote
> On Wed, Nov 28, 2012 at 11:55 AM, bigmealy
> <

> martin.taylor@

> > wrote:
>> T = __delaunayn__ (pts, varargin{:});
> 
> __delaunayn__ is an private function and are usssually not doucmented.
> In this case it doesn't matter casue the .m fuction is just a wrapper
> for it, so the help in the .m function is describing the private
> function.
> 
> Now, there is not such a thing as curly braces modifier. The curly
> braces are used to index (i.e. access the elements) of cells, which
> are a type of general container in Octave (like vector from the C++
> STL). Wehn a function can take an undefined number of input arguments
> we use the varargin (variable input arguments) in its signature. The
> variable varargin, inside a function, contains the arguments that were
> passed to the function. For example, assme that a function foo was
> defined with "function foo (x,varargin)" then
> 
> foo (1)
> 
> will have x==1 and varargin empty inside foo.
> 
> foo (1,"bar",3)
> 
> will have x==1 and varargin == {"bar", 3} inside foo.
> 
> When a cell is indexed with the colon operator ":", it gives all its
> elements. Assume that foo as defined before calls, in its body, a
> function bar with signature "function bar (x,y)". The call
> 
> bar (varargin{:})
> 
> is equivalent to
> 
> bar ("bar", 3)
> 
> To know more about cells read the Octave manual.
> http://www.gnu.org/software/octave/doc/interpreter/Indexing-Cell-Arrays.html
> 
> Cheers

Many thanks for taking the time to reply JP, things are becoming more
apparent to me v-quickly. I've never seen/heard of Octave till a few days
ago. Fantastic!



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Strange-syntax-tp4647311p4647315.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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