function getconvecfmri_block2

%   getconvecfmri_block2

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

%pulsevec=5+[1,  4,  7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247];
pulsevec=4+[1,  4,  7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247];
convec = [3,3,1,2,3,1,1,3,3,3,2,1,2,2,2,1,2,1,3,1,1,2,3,1,1,3,3,1,3,3,3,2,2,2,1,3,2,3,3,2,2,2,3,2,3,1,3,3,2,2,1,2,3,1,2,2,3,3,1,3,1,2,1,1,2,1,1,3,2,3,2,1,1,1,3,2,1,2,1,1,3,1,2];

neutpulses = pulsevec(find(convec==3));
                                                                    
pospulses = pulsevec(find(convec==1));
negpulses = pulsevec(find(convec==2));

xjitterpos=[3,2,4,2,2,3,4,4,2,4,4,1,1,1,2,1,3,1,3,3,2,2,3,1,4,3,1,4]./4;
xjitterneg=[2,4,1,1,3,4,2,2,3,1,3,1,1,1,4,3,2,4,2,3,3,2,2,4,1,4,3]./4;
xjitterneu=[1,3,1,4,2,4,1,2,4,1,2,2,4,4,1,3,2,3,2,2,1,1,4,3,3,3,3,4]./4;

neutpulses = neutpulses + xjitterneu
pospulses = pospulses + xjitterpos
negpulses = negpulses + xjitterneg

neutpulses1 = neutpulses(1:14);
pospulses1 = pospulses(1:14);
negpulses1 = negpulses(1:14);

neutpulses2 = neutpulses(15:28);
pospulses2 = pospulses(15:28);
negpulses2 = negpulses(15:27);


path = uigetdir
cd(path);

%first half
pfid = fopen('pos1.txt','wt');
nfid = fopen('neg1.txt','wt');
ntfid = fopen('neut1.txt','wt');
fprintf(pfid ,num2str(pospulses1));
fprintf(nfid ,num2str(negpulses1));
fprintf(ntfid ,num2str(neutpulses1));
fclose(pfid);
fclose(nfid);
fclose(ntfid);

%second half
pfid = fopen('pos2.txt','wt');
nfid = fopen('neg2.txt','wt');
ntfid = fopen('neut2.txt','wt');
fprintf(pfid ,num2str(pospulses2));
fprintf(nfid ,num2str(negpulses2));
fprintf(ntfid ,num2str(neutpulses2));
fclose(pfid);
fclose(nfid);
fclose(ntfid);



return