help-octave
[Top][All Lists]
Advanced

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

Re: at-sign in function call


From: David Bateman
Subject: Re: at-sign in function call
Date: Wed, 14 Jun 2006 15:17:52 +0200
User-agent: Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322)

Wolfgang Lindner wrote:

>David Bateman schrieb:
>  
>
>>>[MU, R, J] = nlinfit(k, x, @constMu, anfMu)
>>>Q: what is the meaning of @?
>>>      
>>>
>>This is a function handle.
>>    
>>
>>>  What are your recommendations?
>>>      
>>>
>>use a newer version of octave..
>>    
>>
>
>Thank you David,
>
>I see there is rapid progess - and I had say good bye to my brave old friend 
>octave 2.1.50/win .. at least for using handles.
>
>Please, would someone be so kind and give me a link, where I can find good 
>infos 
>about the concept/idea/surplus and use of 'function handle'?
>Googling I get only hits about MatLAB-handles .. is that ok for octave's @?
>
>  
>
The only thing that an octave function handle can't do that a matlab one
can do at the moment is the scoping of variables passed to an anonymous
function handle that is

a = 1.;
f = @(x) x +a;
f(1)

will create an anonymous function handle with a resolved to 1 at the
time of the handles creation, while in octave the scope happens at the
time of the evaluation and so this will in fact
cause an error.. So effectively this limits octave to having constants
and known arguments in anonymous function handles only. A workaround for
octave is

a = 1.;
eval(sprintf("f = @(x) x + %g;", a);
f(1)

we also can't load/save function handles to matlab files, but can to
octave files. Therefore most of what you read at

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/function_handle.html
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f7-60371.html#function_handles
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f4-70115.html#anonymous_functions

will be valid.

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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