matlab compability of str2func
Jaroslav Hajek
highegg at gmail.com
Fri Jun 12 04:13:11 CDT 2009
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
More information about the Bug-octave
mailing list