From: Atahan Tolunay on
"Jon " <anti_pope.remove.this(a)hotmail.com> wrote in message <hupcb1$7ul$1(a)fred.mathworks.com>...
> "Atahan Tolunay" <atato326(a)hotmail.com> wrote in message <hupbs1$7k3$1(a)fred.mathworks.com>...
> > I have several files named "Jack.mat, Peter.mat, Kelly.mat" in my folder. When I start up my MainGUI.m I want all those file names to be imported to my listbox. What kind of function do I need to write in the listbox1_CreateFcn to import all .mat file names in my folder into the listbox on startup?
>
> cd('directory') moves you to the directory
>
> names = dir('*.dat') would find every file ending in .dat and save it to a structure.
>
> names(1).name would give you the name of the first file for instance.

Thanks that worked! But how do I get rid of the .mat in the filename? I just want Jack, Peter, Kelly and not Jack.mat, Peter.mat, Kelly.mat.