Path: news.mathworks.com!not-for-mail
From: "G.A.M. " <x0zero@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Visible figure has no gui handle. Why?
Date: Wed, 29 Aug 2007 21:38:17 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 40
Message-ID: <fb4p09$5s9$1@fred.mathworks.com>
References: <fav61d$7a5$1@fred.mathworks.com> <fav7q6$d5g$1@canopus.cc.umanitoba.ca> <fav8uo$5oc$1@fred.mathworks.com> <fb4l5m$4u4$1@fred.mathworks.com> <MPG.213faab8f387c2f39897ab@news.mathworks.com>
Reply-To: "G.A.M. " <x0zero@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1188423497 6025 172.30.248.38 (29 Aug 2007 21:38:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 29 Aug 2007 21:38:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1030060
Xref: news.mathworks.com comp.soft-sys.matlab:426161


Hi Loren,
Thanks for your reply. Unfortunately, I don't quite
understand it yet. I appreciate a clarification :)

My issue is that my main gui is displayed on the screen but
when I attempt to get a handle to it in my m-file code I get
an error that indicates the value returned by findobj('Tag',
'figureM') isn't valid. This seems very strange.

I simply want to have a gui figure display on the screen and
remain accessible/valid while the user clicks buttons and
causes various plots to be displayed. This seems like the
normal behavior one would expect, so I'm baffled that I'm
getting invalid handle errors - especially because I can see
the figure on the screen at the time of the errors.

The code I pasted was executed in the workspace as an
attempt to help me debug the problem. However, the problem
occurs in the m-file code. I simply can't seem to use
findobj('Tag', 'figureM') as one would expect it to be used.

> You have to pass possible handles or ancestors into
findall.  These all 
> worked for me as I expected:
> 
> h = figure('Tag','figureM');
> h(2) = figure;
> 
> >>findall(h,'tag','figureM')
>    1
> >>findall(0,'tag','figureM')
>    1
> >>findall(h(2),'tag','figureM')
>    Empty matrix: 0-by-1
> 
> 
> -- 
> Loren
> http://blogs.mathworks.com/loren/