%	Tmp.m

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


FileMat=char('Rudi:Data:EEG:AlterPix:AP1Hz.fl20.at1.ar')
FileMat=char(FileMat,'Rudi:Data:EEG:AlterPix:AP1Hz.fl20.at0.ar');

[NFiles,FileMat]=ReadFileNames(FileMat,'*.at*','Choose file:')

[File1,Path1,FilePath1]=GetFileNameOfMat(FileMat,1);
[AvgMat1,File1,Path1,FilePath1,NTrialAvgVec,StdChanTimeMat,SampRate,AvgRef,...
Version,MedMedRawVec,MedMedAvgVec,EegMegStatus,NChanExtra]=ReadAvgFile(FilePath1);
SizeAvgMat=size(AvgMat1)
[File2,Path2,FilePath2]=GetFileNameOfMat(FileMat,2);
AvgMat2=ReadAvgFile(FilePath2);
AvgMat=AvgMat1;
AvgMat(51:500)=AvgMat(51:500)+AvgMat2(1:450);
AvgMat(1:50)=AvgMat(1:50)+AvgMat2(451:500);
%AvgMat=AvgMat./2;
SaveAvgFile([FilePath,'.50'],AvgMat,NTrialAvgVec,StdChanTimeMat,SampRate,MedMedRawVec,MedMedAvgVec);
return;
