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