[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?)
From: |
Ben Abbott |
Subject: |
Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?) |
Date: |
Wed, 08 Oct 2008 11:37:22 -0400 |
On Wednesday, October 08, 2008, at 10:55AM, "Michael Goffioul" <address@hidden>
wrote:
>On Wed, Oct 8, 2008 at 3:25 PM, Ben Abbott <address@hidden> wrote:
>> Nice deduction.
>>
>> If I place a "drawnow" after "plot(1:10)" then the script does produce the
>> "invalid handle" error :-)
>>
>> Does this indicate that "get(hc,...)" command is effectively executed prior
>> to the "delete(hc)"?
>
>No. If you look carefully at the result of the get(hc) when you type
>it manually,
>then you see that it's a text object, most probably one of the labels or title
>of the current axes object. This is a side-effect of the handle recycling that
>we already talked about in a previous thread, in combination with the fact that
>the title and labels text object are created on-demand (for instance during a
>drawnow execution).
>
>I think what's happening is the following:
>when you run the script
>- the "plot" call creates the axes and the line object
>- initially the title and labels object are no created
>- as you are in a m-script, no drawnow occurs
>- during the "delete" call, the line object is deleted and the
> handle is recycled
>- the final "get" call fails, because hc is an invalid handle
>when you return to the prompt
>- drawnow is executed
>- title and labels objects are created by the execution of
> drawnow (because drawnow accesses Title and XYZLabel
> properties)
>- the first object created will recycle the hc value
>- get(hc) does not fails, because it is now a valid (text) object
>
>That's why I think handle recycling is not a good idea...
>
>Michael.
Thanks for the explanation.
Do you imply that x/y/zlabels and the title will show up under
get(gca,'children')?
Ben
- Re: [Changeset]: Re: cla() ?, (continued)
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/07
- Re: [Changeset]: Re: cla() ?, David Bateman, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/07
- Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Ben Abbott, 2008/10/07
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Søren Hauberg, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Ben Abbott, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Michael Goffioul, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?),
Ben Abbott <=
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), John W. Eaton, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Michael Goffioul, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), John W. Eaton, 2008/10/08
- Re: [Changeset]: Re: cla() ?, John W. Eaton, 2008/10/08
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/10
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/10
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/10
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/10
- Re: [Changeset]: Re: cla() ?, John W. Eaton, 2008/10/10
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/10