UI get file or dirrectory

42 views (last 30 days)
Adam on 12 Nov 2012
Is there a command similar to, or a way to utilize either uigetfile, or uigetdir that allows a user to select either a file OR a directory and not just one or the other?
e.g. i have a function which will parse/import an entier directory, or individually specified files and i would like a UI window which allows the user to select individual files to be imported or a directory to be imported.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 12 Nov 2012
Edited: Azzi Abdelmalek on 12 Nov 2012
if you want to have a file name with its path
Azzi Abdelmalek
Azzi Abdelmalek on 12 Nov 2012
The use uigetdir. If you want him to choose add a code like this
str ={'select file','select folder'}
s = listdlg('PromptString','Select a file:','SelectionMode','single','ListString',str)
if s==1

Sign in to comment.


Find more on Dialog Boxes in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!