matlab compability of str2func

Norbert Froehlich Norbert.Froehlich at mailbox.tu-dresden.de
Fri Jun 12 08:53:22 CDT 2009


Zitat von Jaroslav Hajek <highegg at gmail.com>:

> On Fri, Jun 12, 2009 at 11:10 AM, Ben Abbott<bpabbott at mac.com> wrote:
>>
>> On Jun 12, 2009, at 4:55 AM, Jaroslav Hajek wrote:
>>
>>> On Thu, Jun 11, 2009 at 2:51 PM, Norbert
>>> Froehlich<Norbert.Froehlich at mailbox.tu-dresden.de> wrote:
>>>>
>>>> Bug report for Octave 3.0.3 configured for i686-pc-msdosmsvc
>>>>
>>>> Description:
>>>> -----------
>>>>
>>>>  When I execute the following code in Matlab I get a correct function
>>>> handle, but not in octave.
>>>>
>>>>> f = str2func('>=');
>>>>
>>>> The error message in octave is:
>>>> error creating function handle "@>="
>>>>
>>>
>>> I don't see this documented in Matlab docs. Do you? If not, can you
>>> give an example of usage of such a feature (compared to using "ge")?
>>>
>>
>>
>> I tried it in Matlab 2009a, and it does work.
>>
>>>> my_ge = str2func ('>=')
>>
>> my_ge =
>>
>>    @ge
>>
>>>> my_gt = str2func ('>')
>>
>> my_gt =
>>
>>    @gt
>>
>>>> my_ge (1, 2)
>>
>> ans =
>>
>>     0
>>
>>>> my_ge (2, 1)
>>
>> ans =
>>
>>     1
>>
>> Could this be an accident of the parser?
>>
>> Ben
>
> That's what came to my mind. Maybe it would be useful to allow this,
> but I'd like a real example of usage (where it provides advantage over
> @ge).
>
> regards
>
> --
> RNDr. Jaroslav Hajek
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
>
>

I think there is no 'real' advantage exept the less effort, to make  
matlab code work in octave. It's really only for compability.

regards
Norbert Froehlich



More information about the Bug-octave mailing list