function spikes3( num_std ) if ( ~exist( 'num_std' ) ) num_std = 5; end if ( ~exist('sp_data') ) load( sprintf( 'sp%d_data', num_std ) ); end %spiketrains 1ms bins sp=zeros(64,10000); for i = 1:64 spike_times = round(sp_data{i}*1000); % better to round() than to ceil() for j = 1:length(spike_times) sp(i,spike_times(j)) = sp(i,spike_times(j)) + 1; % account for double spikes end end %spiketrains 10ms bins sp1000=zeros(64,1000); for i=1:1000 min_i = max( i*10-11, 1 ); max_i = min( i*10+2, 10000 ); sp1000(:,i) = sum( sp(:,i*10-7:i*10-2), 2 ) + ... 0.5*sum( sp(:,[ min_i:i*10-8 i*10-1:max_i ]), 2 ); end xc_len = 500; %nodes = [ 25 26 27 30 31 35 36 41 43 44 46 49 50 51 52 54 57 58 59 60 63 64 ]; nodes = 1:64; xc=cell(64); for i = 1:length(nodes)-1 ChA = nodes(i); disp( sprintf( 'Computing xc{%d,:}', ChA ) ); for j = i+1:length(nodes) ChB = nodes(j); xc{ChA,ChB} = xcov( sp(ChA,:), sp(ChB,:), xc_len ); end end xc1000=cell(64); for i = 1:length(nodes)-1 ChA = nodes(i); disp( sprintf( 'Computing xc1000{%d,:}', ChA ) ); for j = i+1:length(nodes) ChB = nodes(j); xc1000{ChA,ChB} = xcov( sp1000(ChA,:), sp1000(ChB,:), xc_len/10 ); end end save( sprintf( 'xc%d_data', num_std ), 'sp', 'sp1000', 'xc', 'xc1000' ); return;