[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'cla reset' clears user properties?
From: |
Ben Abbott |
Subject: |
Re: 'cla reset' clears user properties? |
Date: |
Thu, 23 Jan 2014 16:30:26 -0500 |
On Jan 23, 2014, at 3:23 PM, Julien Bect <address@hidden> wrote:
> On 23/01/2014 19:30, Rik wrote:
>
>> What do people think the following code should do?
>>
>> close all
>> hax = gca;
>> addproperty ("__foobar__", hax, "data", [1 2])
>> cla reset
>> isprop (hax, "__foobar__")
>
> Matlab doesn't have addproperty, but the following experiment is informative :
>
> close all; set (gca, 'UserData', 333); cla; get (gca, 'UserData') % returns
> 333
>
> close all; set (gca, 'UserData', 333); cla reset; get (gca, 'UserData') %
> returns []
>
>
> Thus, IMO, "cla reset" should at least clear the content of user properties,
> if not completely remove the properties.
>
> @++
> Julien
Matlab's appdata is persistent.
clf ()
setappdata (gca (), 'foo', 'bar');
cla reset
getappdata (gca (), 'foo')
ans =
bar
Presently, Octave uses addproperty() to implement setappdata() and getappdata().
For compatibility, we should leave the user created properties alone (which is
what Octave presently does).
Ben