CondFileMat=[];
DefFilePath=SetDefPath(1,'.con');
[NCondFiles,CondFileMat]=ReadFileNames(CondFileMat,DefFilePath,'Choose the condition file(s):');
for FileInd=1:NCondFiles
    [File,Path,FilePath]=GetFileNameOfMat(CondFileMat,FileInd);
%   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.                                                                      
    CondVec=ReadAscii(FilePath);
    a=CondVec;
    b=diff(a);
    c=find(abs(b)>0);
    c=[1;c+1]
    for i=1:length(c)
        d=a(c(i));
        a(c(i)+[0:8])=(10+d).*ones(9,1);
        a(c(i)+[9:17])=(20+d).*ones(9,1);
        a(c(i)+[18:26])=(30+d).*ones(9,1);
        a(c(i)+[27:35])=(40+d).*ones(9,1);
    end
    for i=1:5
        b=find(a==i);
        a(b)=(i+40).*ones(size(b));
    end
    SaveAscii(CondVec,[FilePath,'.orig'])
    SaveAscii(a,FilePath)
end
return
% CondFileMat=[];
% DefFilePath=SetDefPath(1,'.con');
% [NCondFiles,CondFileMat]=ReadFileNames(CondFileMat,DefFilePath,'Choose the condition file(s):');
% for FileInd=1:NCondFiles
%     [File,Path,FilePath]=GetFileNameOfMat(CondFileMat,FileInd);
%     CondVec=ReadAscii(FilePath);
%     a=CondVec;
%     b=diff(a);
%     c=find(abs(b)>0);
%     c=[1;c+1]
%     for i=1:length(c)
%         d=a(c(i));
%         a(c(i)+[0:11])=(10+d).*ones(12,1);
%         a(c(i)+[12:23])=(20+d).*ones(12,1);
%     end
%     for i=1:5
%         b=find(a==i);
%         a(b)=(i+30).*ones(size(b));
%     end
%     SaveAscii(CondVec,[FilePath,'.orig'])
%     SaveAscii(a,[FilePath,'.new'])
% end
