Thread Subject: pop up menu in GUI should display list of files in a folder

Subject: pop up menu in GUI should display list of files in a folder

From: aashay vanarase

Date: 16 Mar, 2010 18:54:06

Message: 1 of 4

i want my pop up menu in GUI to display list of files in a folder...
most i know till date is using the 'uigetfile' command to select a particular file..

can anyone help me...

any help will be appreciated

Subject: pop up menu in GUI should display list of files in a folder

From: us

Date: 16 Mar, 2010 19:10:19

Message: 2 of 4

"aashay vanarase" <aashayv@gmail.com> wrote in message <hnok4e$918$1@fred.mathworks.com>...
> i want my pop up menu in GUI to display list of files in a folder...
> most i know till date is using the 'uigetfile' command to select a particular file..
>
> can anyone help me...
>
> any help will be appreciated

one of the many solutions

     uh=uicontrol(...
          'units','normalized',...
          'position',[.1,.1,.4,.8],...
          'style','listbox');
     dd=dir('*.*');
     set(uh,...
          'string',{dd.name});

us

Subject: pop up menu in GUI should display list of files in a folder

From: Walter Roberson

Date: 16 Mar, 2010 19:22:50

Message: 3 of 4

aashay vanarase wrote:
> i want my pop up menu in GUI to display list of files in a folder...
> most i know till date is using the 'uigetfile' command to select a
> particular file..
>
> can anyone help me...

uigetdir() to select the directory; then use dir() on the selected directory
to obtain the list of files stored in that directory. The output of dir() is a
structure; you can access the 'name' field of the structure entries to get the
names.

DirEntries = dir('C:\');

%the below line looks simple but uses an advanced technique
h = uicontrol('Style','popup', 'String', {DirEntries.name});

Subject: pop up menu in GUI should display list of files in a folder

From: aashay vanarase

Date: 17 Mar, 2010 13:12:24

Message: 4 of 4

Walter Roberson <roberson@hushmail.com> wrote in message <hnolqb$qh9$1@canopus.cc.umanitoba.ca>...
> aashay vanarase wrote:
> > i want my pop up menu in GUI to display list of files in a folder...
> > most i know till date is using the 'uigetfile' command to select a
> > particular file..
> >
> > can anyone help me...
>
> uigetdir() to select the directory; then use dir() on the selected directory
> to obtain the list of files stored in that directory. The output of dir() is a
> structure; you can access the 'name' field of the structure entries to get the
> names.
>
> DirEntries = dir('C:\');
>
> %the below line looks simple but uses an advanced technique
> h = uicontrol('Style','popup', 'String', {DirEntries.name});

thanks for all the help...
one more thing... how can this be modified so that i get the location (c:\...) of the file selected in the drop down list when i select it

also, i am storing images in that folder... is it possible to show the corresponding image in the gui for the filename as i scroll down the pop up list

any help will be appreciated

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
dir us 16 Mar, 2010 15:14:11
uicontrol us 16 Mar, 2010 15:14:11
code us 16 Mar, 2010 15:14:11
graphics handle us 16 Mar, 2010 15:14:11
gui aashay vanarase 16 Mar, 2010 14:59:06
pop up menu aashay vanarase 16 Mar, 2010 14:59:06
rssFeed for this Thread

Contact us at files@mathworks.com