tags:

views:

182

answers:

2

I have created a blank GUI and now I want to program a push button to display a file or directory browser dialog.

+2  A: 

Your question could use a little more detail, but here's a general suggestion to get you started...

You could set the callback for your push button so that it invokes one of the built-in dialog boxes available in MATLAB. You may be most interested in UIGETDIR or UIGETFILE to browse for and select a directory or file, respectively.

gnovice
+2  A: 

In addition to gnovice's advice, if you want your directory browser to be embedded within your GUI (as opposed to opening in a separate dialog window), you can use Java component. Take a look at my UICOMPONENT utility on the File Exchange for a working example.

Alternately, you can design your own tree-view of folder contents within a matlab panel, using the documented yet unsupported UITREE function or a Java JTree component (take a look at my UIINSPECT or FINDJOBJ utilities for working examples).

Yair Altman