More questions about function handles

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

More questions about function handles

John W. Eaton
Administrator
Could someone please run some more function handle tests in Matlab?

Unpack the attached zip file and then in Matlab, cd to the str2func-test
directory and run the tstscript script.  It should create a diary file.
Post or send that file to me.

Thanks!

jwe


str2func-test.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

nrjank
On Wed, May 6, 2020 at 2:39 PM John W. Eaton <[hidden email]> wrote:
It should create a diary file.
Post or send that file to me.

Matlab 2020a.  diary attached 
Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

John W. Eaton
Administrator
On 5/6/20 3:21 PM, Nicholas Jankowski wrote:
> On Wed, May 6, 2020 at 2:39 PM John W. Eaton <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     It should create a diary file.
>     Post or send that file to me.
>
> Matlab 2020a.  diary attached

Thanks.  Seems strange that the calls to str2func with '-' and '*' find
the local and private functions but that '+' doesn't find the nested
function.  WTF, Matlab?!?

jwe

Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

nrjank

WTF, Matlab?!?

I believe there's a reason that's an official bug category. 
Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

John W. Eaton
Administrator
On 5/6/20 3:41 PM, Nicholas Jankowski wrote:
>
>     WTF, Matlab?!?
>
> I believe there's a reason that's an official bug category.

Indeed.

I guess I should also test what happens for class methods.  I'm
attaching another version of the zip file that attempts to test whether
the function handle created by str2func can refer to a class method.
I'm guessing no, but I've been surprised before, so same as before ...

Could someone please run some more function handle tests in Matlab?

Unpack the attached zip file and then in Matlab, cd to the str2func-test
directory and run the tstscript script.  It should create a diary file.
Post or send that file to me.

jwe

str2func-test.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

nrjank
Unpack the attached zip file and then in Matlab, cd to the str2func-test
directory and run the tstscript script.  It should create a diary file.
Post or send that file to me.


didn't get very far this time. 
Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

John W. Eaton
Administrator
On 5/6/20 8:50 PM, Nicholas Jankowski wrote:
>     Unpack the attached zip file and then in Matlab, cd to the
>     str2func-test
>     directory and run the tstscript script.  It should create a diary file.
>     Post or send that file to me.
>
>
> didn't get very far this time.

Oh, the definition of the get_fh method in tstcls.m should be

   function fh = get_fh (obj)
     ...

instead of

   function fh = get_fh ()
     ...

Can you make that change an try running the script again?

Thanks,

jwe


Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

nrjank
Can you make that change an try running the script again?


got farther that time  
Reply | Threaded
Open this post in threaded view
|

Re: More questions about function handles

John W. Eaton
Administrator
On 5/7/20 1:00 PM, Nicholas Jankowski wrote:
>     Can you make that change an try running the script again?
>
>
> got farther that time

Thanks.

Now it seems even more strange that the nested plus function is not
found.  I mean, wouldn't @plus instead of str2func ('+') in that context
find it and create a handle to the nested function?

I guess it makes sense that the mrdivide method is no longer visible
after clearing functions and removing the directory containing the class
definition from the path.  But if that is expected behavior for any
class method, not just when using handles, then Octave does not appear
to handle that correctly.

jwe