function filename = secfile(filelist)


% tstool/secfile
% filename = secfile(filelist)
%
% this GUI is always called when a second
% filename is needed to execute a callback for tstool
% the name of the selected file is returned

global TSTOOLdatapath;

fighandle = findobj('Tag', 'TSTOOL');  % Filename ist in den UserData der TSTOOL-Figure gespeichert
handles = get(fighandle, 'UserData');	% structure with handles to the different menus/controls of the figure
answer=get(handles.loadhandle,'UserData');
TSTOOLfilter=answer{1};
cwd=answer{2};
datafiles=get(handles.lboxhandle,'UserData');


load secfile                           

filename = '';

a = figure('Color',[0.8 0.8 0.8], ...
	'Colormap',mat0, ...
	'Position',[697 443 483 185], ...
	'Resize', 'off', ...
	'MenuBar','none', ...
	'NumberTitle','off', ...
	'Name','Select signal file', ...
	'Tag','SecondaryFileSelectBox');
b = uicontrol('Parent',a, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0 0 386.4 148], ...
	'String', filelist, ...
	'Style','listbox', ...
	'Tag','Listbox1', ...
	'Callback','filelist = get(gcbo, ''String''); set(gcbo, ''UserData'', filelist{get(gcbo, ''Value'')}); uiresume', ...
	'Value',1);


uiwait
filename = fullfile(TSTOOLdatapath,[getlastentry(datafiles,get(b, 'Value')) TSTOOLfilter]);
close(gcf)

