octave-maintainers
[Top][All Lists]
Advanced

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

Re: Need test run in Matlab


From: Burgers, A.R. (Teun)
Subject: Re: Need test run in Matlab
Date: Wed, 18 Dec 2019 20:53:53 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1

Op 18-12-2019 om 18:51 schreef John W. Eaton:
On 12/18/19 12:37 PM, John W. Eaton wrote:
On 12/18/19 10:11 AM, Juan Pablo Carbajal wrote:

These are the results

Thanks.

after I modified f1 and f2 (attached; Matlab
2019a doesn't  accept declaration of persistent and initialization in
the same line)

Oops.

It looks like the private function is loaded the first time it is used and then also cleared by the "clear functions" command.  But then it also remains available through the handle.  So I'm wondering whether the handle should retain a reference to the function and "clear functions" should only remove it from thh symbol table, or whether it should be reloaded if it becomes invalid.  I'm thinking the first option would be best unless someone knows of a reason to do otherwise.

Here's another test to run to see whether keeping a reference to the function in the handle will be compatible with Matlab behavior:  unpack the attached file and execute the following commands in Matlab:

cd fh-bug
fh = f1
fh()         %% should display "foo-i-hithere: 1"
f2           %% should display "foo-i-hithere: 2"
clear functions   %% what will happen with persistent value in "gg"?
fh()         %% does this display "... 3" or "... 1"?
f2           %% does this display "... 1" or "... 2" or ?

jwe

I get this:

>> version
ans = '9.5.0.1049112 (R2018b) Update 3'

>> cd fh-bug
>> fh = f1

fh =  function_handle with value:    @gg

>> fh()
foo-i-hithere: 1
>> f2
foo-i-hithere: 2
>> clear functions
>> fh()
foo-i-hithere: 1
>> f2
foo-i-hithere: 2




reply via email to

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