User`s guide
List Box Director y Reader (GUIDE)
% hObject handle to figure
% eventdata reserved - to be defined in a future v ersion of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled (see VARARGIN)
% Choose default command line output for lbox2
handles.output = hObject;
% Update handles structure
guidata(hObject, h andles);
if nargin == 3,
initial_dir = pwd;
elseif nargin > 4
if strcmpi(varargin{1} ,'dir')
if exist(varargin{2},'dir' )
initial_dir = varargin{2};
else
errordlg({'Input argu ment must be a valid',...
'folder'},'Input Ar gument Error!')
return
end
else
errordlg('Unrecognized inp ut argument',...
'Input Argument Error!');
return;
end
end
% Populate the listbox
load_listbox(initial_dir,handles)
Load the List Box
This example uses a subfunction to load items into the list box. This
subfunction accepts the path to a folder and the
handles structure as input
arguments and performs these steps:
• Change to the specified folder so that the GUI can navigate up and down
the tree, as required.
10-57