|
From: | John W. Eaton |
Subject: | Re: str2func |
Date: | Wed, 13 Mar 2019 02:09:58 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 |
On 3/13/19 1:42 AM, c. wrote:
Hi, In the development branch str2func works with any stringf = str2func ("_5yVNhWVJWJn47RKnzxPsyb_")f = @_5yVNhWVJWJn47RKnzxPsyb_ while in the stable release it returns an error if the string does not name an existing functionf = str2func ("_5yVNhWVJWJn47RKnzxPsyb_")error: @_5yVNhWVJWJn47RKnzxPsyb_: no function and no method found Is this intended, or is it a bug? If it is intended, there are a few places where str2func is used to check whether a string is the name of a function (for example ode45, ode15i, ...) which should be fixed. If this is not intended I'll submit a bug
It's intentional, for compatibility with Matlab. There are a few bug reports about it. But I was fixing a different bug when I also fixed the problem with str2func.
https://savannah.gnu.org/bugs/?func=detailitem&item_id=52568 https://savannah.gnu.org/bugs/?func=detailitem&item_id=31821 Why do you need to check?Also, I would strongly recommend that people use function handles, not simple names in character strings.
jwe
[Prev in Thread] | Current Thread | [Next in Thread] |