From: Ana B Garcia Bouso on
Hello all,

I am using the function [FileName,PathName,FilterIndex] = uigetfile(FilterSpec,DialogTitle) to get user input.
Matlab documentation says that one wants to block program execution until
the user responds, it should be used together with "uiwait".
Here comes my question:

How to use uigetfile together with uiwait when calling uigetfile with its output parameters? I mean, this is the code I have:

%First get user current directory

fileroute=pwd;
filename=strcat(fileroute,'/*.m');

%The variable fname stores the selected file name, froute stores its route
%and filterindex is is the index of the filter selected in the dialog box.
%Indexing starts at 1. If user clicks Cancel or closes the dialog window,
%the function sets FilterIndex to 0.

%Call function uigetfile

[fname,froute,filterindex]=uigetfile(filename,'Select M-file ');

If it were a simple message box what one could do is, for instance:

uiwait(msgbox('Some empty fields. Please, provide input again.','Error','error','modal'));

and in this case the program is blocked until the user presses 'OK' in the message window.

But I don't know how to do the same when calling uigetfile.
One thing one could do is calling it as:

uiwait(uigetfile(filename,'Select M-file '));

but then I cannot know what is the path and name of the file the user has provided ...

Do you know how to fix it or if it is really necessary using uiwait in my case?

Many thanks in advance.

Best regards,
Ana
From: Doug Schwarz on
In article <hvfc1o$j6g$1(a)fred.mathworks.com>,
"Ana B Garcia Bouso" <serendipity14071789(a)gmail.com> wrote:

> Hello all,
>
> I am using the function [FileName,PathName,FilterIndex] =
> uigetfile(FilterSpec,DialogTitle) to get user input.
> Matlab documentation says that one wants to block program execution until
> the user responds, it should be used together with "uiwait".

[snip]

> Do you know how to fix it or if it is really necessary using uiwait in my
> case?

uigetfile already blocks so you don't need to use uiwait at all.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
From: Ana B on

> uigetfile already blocks so you don't need to use uiwait at all.

Many thanks for your reply, Doug! That is what I was expecting but since in matlab help says something about using uiwait, I wanted to be sure.
Regards,
Ana