help-octave
[Top][All Lists]
Advanced

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

Re: Lists of function handles


From: David Bateman
Subject: Re: Lists of function handles
Date: Tue, 07 Feb 2006 17:14:27 +0100
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

John W. Eaton wrote:

On  7-Feb-2006, address@hidden wrote:

| I am trying to create a list of function handles. This seems to be
| possible in Matlab, but generates errors in Octave:
|
| >>function r = basisFunction1(x)
|       r  =  1;
| endfunction
|
| >>function r = basisFunction2(x)
|       r  =  x;
| endfunction
|
| >>a(1)  =  @basisFunction1
| error: can't perform indexed assignment for function handle type
| error: assignment failed, or no method for `<unknown type> = function
| handle'
| error: evaluating assignment expression near line 1, column 6
|
| Any work-around? Thx

Yes, use cell arrays as David said.

I just wanted to point out that in future versions of Matlab, you
won't be able to use the style of indexing you show above.  I think
R14 gives a warning about it now.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

I can confirm that with R14sp2 I get the following warning

Warning: Arrays of function handles will not be supported in future versions
of MATLAB, but will continue to work in R14.  To avoid this warning and to
prepare for the change, use cell arrays of function handles instead of arrays.
For more information, type 'help function_handle' and see the section
entitled Note on Backward Compatibility.

Regards
David

--
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



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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