help-octave
[Top][All Lists]
Advanced

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

Re: [newbie] how to avoid a for-loop


From: Marco Atzeri
Subject: Re: [newbie] how to avoid a for-loop
Date: Thu, 18 Dec 2014 22:49:50 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 12/18/2014 9:33 PM, Jean Dubois wrote:
2014-12-18 18:26 GMT+01:00 Marco Atzeri <address@hidden>:
On 12/18/2014 5:40 PM, Jean Dubois wrote:


thanks Marco,
This is what I made of it:
function [result] = calp(m)
k=[0:m];
n=2*m-k;
result=arrayfun(@nchoosek,n,k)

it works fine, the only thing which I don't understand quite is why
the @ is necessary?

without the @ the interpreter can not discriminate between a function and a variable called in the same way

http://www.gnu.org/software/octave/doc/interpreter/Function-Handles.html#Function-Handles

kind regards,
jean






reply via email to

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