The code below iterates over a list of electrodes (ii), 60 in total and gives for each electrode the total sum of spikes. I need however the number of spikes per 'bin' of 20 seconds as defined in edges.

1 view (last 30 days)
%% Binning_spikes
fileID = fopen('filename', 'r'); formatSpec = '%f %d %d'; sizeA = [3 Inf]; [A,count] = fscanf(fileID,formatSpec,sizeA); fclose(fileID); A=A'; edges = 0:20:600; N = histc(A(:,1)*1e-3,edges); bar(edges,N) h = findobj(gca,'Type','patch'); set(h,'FaceColor','r','EdgeColor','w') spks = cell(length(unique(abs(A(:,2)))),1); n = cell(length(unique(abs(A(:,2)))),1); V = zeros(length(unique(abs(A(:,2)))),1); for ii = unique(abs(A(:,2)))' spks{ii} = A(find(abs(A(:,2))==ii),1)*1e-3; V(ii) = (length(spks{ii})) fprintf(1,'Channel %d spikes %d \n',ii,length(spks{ii})) end norm_data = (V - min(V)) / ( max(V) - min(V) )

Answers (0)

Categories

Find more on Electrophysiology in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!