function ampmatchfenster(filename,filepath,mode)
%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      

if isempty(mode)
    modefehler
    return
end
if mode==0
   modefehler
   return
      
% directory mode   
elseif mode==11
	cd (filepath);
	filelist=dir(filepath);
   filelistsize=size(filelist);
   filelistgroesse=filelistsize(1);
   kritfilelistgroesse=0;
   
   while kritfilelistgroesse~=filelistgroesse
   [kritfilename, kritfilepath] = uigetfile('*.*', 'Bitte wählen sie die Kriteriumsdirectory aus:', 300, 300);
   cd(kritfilepath);
   kritfilelist=dir(kritfilepath);
   kritfilelistsize=size(filelist);
   kritfilelistgroesse=kritfilelistsize(1);
	end


   % Schleife für Files
   for filezaehler=3:filelistsize(1)
      filename2=filelist(filezaehler).name;
      kritfilename2=kritfilelist(filezaehler).name;
      [fileamplitude,kritfileamplitude,matchfileamplitude]=ampmatch(filename2,filepath,kritfilename2,kritfilepath);
         
   end
   ok
   
% batchfile mode   
elseif mode==12
   return
      
% single file mode   
elseif mode==2

   [kritfilename, kritfilepath] = uigetfile('*.*', 'Bitte wählen sie das Kriteriumsfile aus:', 300, 300);
   [fileamplitude,kritfileamplitude,matchfileamplitude]=ampmatch(filename,filepath,kritfilename,kritfilepath);
   
   % Abbildung erstellen 
   
   figure
	subplot(3,1,1)
	plot(fileamplitude)
	subplot(3,1,2)
	plot(kritfileamplitude)
	subplot(3,1,3)
	plot(matchfileamplitude)
   
end

return

