fixed code style
This commit is contained in:
parent
328eb8838a
commit
f0c3c7f825
@ -1,7 +1,7 @@
|
||||
function [pdf, centers] = isiHist(isis, binwidth)
|
||||
function [pdf, centers] = isihist(isis, binwidth)
|
||||
% Compute normalized histogram of interspike intervals.
|
||||
%
|
||||
% [pdf, centers] = isiHist(isis, binwidth)
|
||||
% [pdf, centers] = isihist(isis, binwidth)
|
||||
%
|
||||
% Arguments:
|
||||
% isis: vector of interspike intervals in seconds
|
||||
@ -14,15 +14,15 @@ function [pdf, centers] = isiHist(isis, binwidth)
|
||||
if nargin < 2
|
||||
% compute good binwidth:
|
||||
nperbin = 200; % average number of data points per bin
|
||||
bins = length( isis )/nperbin; % number of bins
|
||||
binwidth = max( isis )/bins;
|
||||
bins = length(isis)/nperbin; % number of bins
|
||||
binwidth = max(isis)/bins;
|
||||
if binwidth < 5e-4 % half a millisecond
|
||||
binwidth = 5e-4;
|
||||
end
|
||||
end
|
||||
bins = 0.5*binwidth:binwidth:max(isis);
|
||||
% histogram data:
|
||||
[ nelements, centers ] = hist(isis, bins);
|
||||
[nelements, centers] = hist(isis, bins);
|
||||
% normalization (integral = 1):
|
||||
pdf = nelements / sum(nelements) / binwidth;
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
function isivec = isis( spikes )
|
||||
function isivec = isis(spikes)
|
||||
% returns a single list of isis computed from all trials in spikes
|
||||
%
|
||||
% isivec = isis( spikes )
|
||||
% isivec = isis(spikes)
|
||||
%
|
||||
% Arguments:
|
||||
% spikes: a cell array of vectors of spike times in seconds
|
||||
@ -12,9 +12,9 @@ function isivec = isis( spikes )
|
||||
|
||||
isivec = [];
|
||||
for k = 1:length(spikes)
|
||||
difftimes = diff( spikes{k} );
|
||||
difftimes = diff(spikes{k});
|
||||
% difftimes(:) ensures a column vector
|
||||
% regardless of the type of vector in spikes{k}
|
||||
isivec = [ isivec; difftimes(:) ];
|
||||
isivec = [isivec; difftimes(:)];
|
||||
end
|
||||
end
|
||||
|
@ -13,18 +13,17 @@ for k = 1:ntrials
|
||||
times = 1000.0*times; % conversion to ms
|
||||
end
|
||||
for i = 1:length( times )
|
||||
line([times(i) times(i)],[k-0.4 k+0.4], 'Color', 'k' );
|
||||
line([times(i) times(i)],[k-0.4 k+0.4], 'Color', 'k');
|
||||
end
|
||||
end
|
||||
if tmax < 1.5
|
||||
xlabel( 'Time [ms]' );
|
||||
xlabel('Time [ms]');
|
||||
xlim([0.0 1000.0*tmax]);
|
||||
else
|
||||
xlabel( 'Time [s]' );
|
||||
xlabel('Time [s]');
|
||||
xlim([0.0 tmax]);
|
||||
end
|
||||
ylabel( 'Trials');
|
||||
ylim( [ 0.3 ntrials+0.7 ] )
|
||||
|
||||
ylabel('Trials');
|
||||
ylim([0.3 ntrials+0.7 ]);
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user