Creating Graphical User Interfaces    

Specifying the Directory to List

You can specify the directory to list when the GUI is first opened by passing the string 'create' and a string containing the full path to the directory as arguments. The syntax for doing this is list_box('create','dir_path'). If you do not specify a directory (i.e., if you call the GUI M-file with no input arguments), the GUI then uses the MATLAB current directory.

The default behavior of the GUI M-file that GUIDE generates is to run the GUI when there are no input arguments or to call a subfunction when the first input argument is a character string. This example changes this behavior so that you can call the M-file with

The following code listing show the setup section of the GUI M-file, which does one the following:


  List Box Directory Reader Loading the List Box