function filename = file_chooser(varargin)
%  name, value pairs for users:
%
% 'startpath'          '.'               path to choose file starts here
% 'glob'               '*'               wildcard expansion for files in dir
% 'promptstring'       'choose a file'   tell the user what to choose
%        
% example: from the cruiseid directory for adcp processing, call as:
%
% filename = file_chooser('startpath','contour','glob','*_xy.mat',...
%                  'promptstring','choose adcpsect output file: *_xy.mat')
%
%% calls file_chooser_part2.m


%make the window to do the choosing

waitfor(file_chooser_part2(varargin{:}), 'tag', 'file_chooser_done')


hfig = findobj('tag', 'file_chooser_done');
cph = findobj(hfig,'tag','txtboxinpath');
filename = get(cph,'string');      
delete(hfig);



