From: Brad on
I am using uigetfile to open files with a variety of extensions. I have a cell containing the various file types for "filterspec". Basically I want to be able to set which file type is active from filterspec, while still keeping the rest of the list available for user selection. Does anyone know how to do this?

uigetfile outputs "filterindex" or the type that is user selected but is there anyway I can set filterindex before the dialog appears??

Thanks
Brad
From: Steven_Lord on


"Brad " <bjjackets(a)yahoo.com> wrote in message
news:i249o0$o5e$1(a)fred.mathworks.com...
> I am using uigetfile to open files with a variety of extensions. I have a
> cell containing the various file types for "filterspec". Basically I want
> to be able to set which file type is active from filterspec, while still
> keeping the rest of the list available for user selection. Does anyone
> know how to do this?
>
> uigetfile outputs "filterindex" or the type that is user selected but is
> there anyway I can set filterindex before the dialog appears??

No, but I believe it defaults to the first row in the filterspec cell array.
Therefore, you could call UIGETFILE using a permuted version of your
filterspec cell array (using indexing) and map that back to the file type in
your original filterspec.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Andy on
"Brad " <bjjackets(a)yahoo.com> wrote in message <i249o0$o5e$1(a)fred.mathworks.com>...
> I am using uigetfile to open files with a variety of extensions. I have a cell containing the various file types for "filterspec". Basically I want to be able to set which file type is active from filterspec, while still keeping the rest of the list available for user selection. Does anyone know how to do this?
>
> uigetfile outputs "filterindex" or the type that is user selected but is there anyway I can set filterindex before the dialog appears??
>
> Thanks
> Brad

I'm not at MATLAB right now, so I can't test this. But I believe the list of file types will show up in the same order as they appear in your cell array. So if you want a particular one to appear first, move it to the top of the cell array before calling uigetfile.
From: Brad on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i24af0$bpc$1(a)fred.mathworks.com>...
> "Brad " <bjjackets(a)yahoo.com> wrote in message <i249o0$o5e$1(a)fred.mathworks.com>...
> > I am using uigetfile to open files with a variety of extensions. I have a cell containing the various file types for "filterspec". Basically I want to be able to set which file type is active from filterspec, while still keeping the rest of the list available for user selection. Does anyone know how to do this?
> >
> > uigetfile outputs "filterindex" or the type that is user selected but is there anyway I can set filterindex before the dialog appears??
> >
> > Thanks
> > Brad
>
> I'm not at MATLAB right now, so I can't test this. But I believe the list of file types will show up in the same order as they appear in your cell array. So if you want a particular one to appear first, move it to the top of the cell array before calling uigetfile.

Thanks, I know I can change the order of the cell. I just have them in alphabetical order and was hoping to enter the index of the one needed without having to manipulate the cell. Oh well thanks for the help.