function [ExistFilePathMat,NFilesExist,NotExistFilePathMat,NFilesNotExist]=GiessenCon;

%   GiessenCon

%   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.  


%---------------------------------------------------------------
% user variables defined here 
%---------------------------------------------------------------
global SubVec
if isempty(SubVec)
   SubVec=[3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25]
end

ActPath=pwd
Con=str2num(ActPath(length(ActPath)-1:length(ActPath)))
Tmp=findstr(ActPath,FileSep);
StatStr=ActPath(Tmp(length(Tmp)-1)+6:Tmp(length(Tmp))-1)
FlipStr=ActPath(Tmp(length(Tmp))+1:Tmp(length(Tmp))+4)
NSub=length(SubVec);
if Con>9
   if strcmp(FlipStr,'Mean')
      ConStr=['m0',int2str(Con)];
   else
      ConStr=['00',int2str(Con)];
   end
   FlipConStr=['f0',int2str(Con)];
else
   if strcmp(FlipStr,'Mean')
      ConStr=['m00',int2str(Con)];
   else
      ConStr=['000',int2str(Con)];
   end
   FlipConStr=['f00',int2str(Con)];
end
NFilesExist=0;
NFilesNotExist=0;
ExistFilePathMat=[];
NotExistFilePathMat=[];
for SubInd=1:NSub
   ActSub=SubVec(SubInd);
   ActSubStr=int2str(ActSub);
	if ActSub<10
   	ActSubStr=['0',ActSubStr];
	end
    BasePath=['F:\ValAro\',ActSubStr,'\snraS',ActSubStr,StatStr,'\'];
    File=['con_',ConStr,'.img'];
    FilePath=[BasePath,File];
    FileExist=exist(FilePath,'file');
     if FileExist==2
      NFilesExist=NFilesExist+1;
   	if NFilesExist==1
      	ExistFilePathMat=char(FilePath);
   	else
     	 	ExistFilePathMat=char(ExistFilePathMat,FilePath);
      end
   else
   	NFilesNotExist=NFilesNotExist+1;
   	if NFilesNotExist==1
      	NotExistFilePathMat=char(FilePath);
   	else
     	 	NotExistFilePathMat=char(NotExistFilePathMat,FilePath);
      end   
   end
   if strcmp(FlipStr,'Flip')
      BasePath=['F:\ValAro\',ActSubStr,'\snraS',ActSubStr,StatStr,'\'];
  	 	File=['con_',FlipConStr,'.img'];
		if ActSub==1
      	if strcmp(StatStr,'Para')
         	ConTmp=Con-2
         	if ConTmp>9
					FlipConStrTmp=['f0',int2str(ConTmp)];
				else
   				FlipConStrTmp=['f00',int2str(ConTmp)];
         	end
         	File=['con_',FlipConStrTmp,'.img'];
      	end      
  		end
   	FilePath=[BasePath,File];
   	FileExist=exist(FilePath,'file');
   	if FileExist==2
      	NFilesExist=NFilesExist+1;
   		if NFilesExist==1
      		ExistFilePathMat=char(FilePath);
   		else
     	 		ExistFilePathMat=char(ExistFilePathMat,FilePath);
    	  end
  	 	else
   		NFilesNotExist=NFilesNotExist+1;
   		if NFilesNotExist==1
      		NotExistFilePathMat=char(FilePath);
   		else
     	 		NotExistFilePathMat=char(NotExistFilePathMat,FilePath);
     	 	end   
   	end      
   end
end
fprintf(1,'%g existing files chosen:\n\n',NFilesExist)
disp(ExistFilePathMat)
fprintf(1,'\n\n')
fprintf(1,'%g not existing files chosen:\n\n',NFilesNotExist)
disp(NotExistFilePathMat)