Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Gui multiple instances
Date: Wed, 4 Nov 2009 20:53:03 +0000 (UTC)
Organization: Mitre Corp
Lines: 36
Message-ID: <hcspjf$a91$1@fred.mathworks.com>
References: <hcq5l4$hek$1@fred.mathworks.com> <hcq938$meu$1@fred.mathworks.com> <hcsfh0$7ag$1@fred.mathworks.com> <hcshts$7b8$1@fred.mathworks.com> <hcskcj$ao9$1@fred.mathworks.com> <hcsm13$onn$1@fred.mathworks.com> <hcsohp$4lb$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1257367983 10529 172.30.248.38 (4 Nov 2009 20:53:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 20:53:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:582521


"Jane " <j.l.terry@hotmail.co.uk> wrote in message <hcsohp$4lb$1@fred.mathworks.com>...
> >   And can I prevent a new window opening in 7.0.1?
> > 
> > % Maybe instead of:
> > if ~isempty(p)
> > % you can try:
> > if ishandle(p)
> > 
> > % And if you are really paranoid, you can test if p is ONLY a
> > % figure handle by testing whether the 'Parent' property is root.
> 
> Thanks,
> I have changed my condition to ishandle.  
> The new figure window in 7.0.1 was caused by the way I had findobj.  I have now changed this to:
> 
> p=findobj('tag','uis','parent',0)

% Ah, yes!

> 
> and it seems to be working fine in both versions of Matlab.
> 
> Thanks agin for your time, it's much appreciated.

% BTW, I noticed that ishandle returns a vector, not a scalar.
% So you may want to use something like:

if any(ishandle(p))

doc if

Remarks
Nonscalar Expressions
If the evaluated expression yields a nonscalar value,
then every element of this value must be true or nonzero 
for the entire expression to be considered true.