Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: GUI question
Date: Mon, 18 Feb 2008 11:29:28 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 34
Message-ID: <fpbq6o$4e2$1@canopus.cc.umanitoba.ca>
References: <fpaofr$ru7$1@fred.mathworks.com> <fpb2v8$5s4$1@canopus.cc.umanitoba.ca> <fpbnqu$2in$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1203334168 4546 192.70.172.160 (18 Feb 2008 11:29:28 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Mon, 18 Feb 2008 11:29:28 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:452081


In article <fpbnqu$2in$1@fred.mathworks.com>,
Phil Au <philipawt@gmail.com> wrote:

>Thx for your reply first.
>It was used in the Browse button, whem i press the button, 
>it was supposed to select an image file and if I selected a 
>file, it will display the path of the file in an edit box,
>and diplay the details of the img and the actual img. 

>But I i press the cancel button, the edit box which used to 
>display the path of the file is disappeareed and when I 
>press the button again, I got this error..

You use fileparts -first- and then you use uigetfile. So any
problem with uigetfile will not be reflected until the -next-
time you call the function.


>> >    [file,path] = uigetfile([pathstr '*.jpg'],'Select an 
>image');

>> What is the documented output result when you cancel a 
>uigetfile
>> dialog?

To answer my hint to you myself: when the user cancels
uigetfile, the return value is the -number- 0, not
a string. You then store that 0 in a handle, and the next
call around, you pull the numeric 0 out and try to use it
in fileparts, which promptly complains because you have not
passed fileparts a string.
-- 
   "Beware of bugs in the above code; I have only proved it correct,
   not tried it."                                    -- Donald Knuth