Home > FMAToolbox > IO > LoadSpikeTimes.m

LoadSpikeTimes

PURPOSE ^

LoadSpikeTimes - Load spike times and cluster IDs from disk.

SYNOPSIS ^

function times = LoadSpikeTimes(filename,rate)

DESCRIPTION ^

LoadSpikeTimes - Load spike times and cluster IDs from disk.

  USAGE

    times = LoadSpikeTimes(filename,rate)

    filename            spike file name (either .clu or .res)
    rate                sampling rate

  OUTPUT

    The output is a list of (timestamp,group,cluster) t-uples.

  SEE

    See also GetSpikeTimes, PlotTicks.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function times = LoadSpikeTimes(filename,rate)
0002 
0003 %LoadSpikeTimes - Load spike times and cluster IDs from disk.
0004 %
0005 %  USAGE
0006 %
0007 %    times = LoadSpikeTimes(filename,rate)
0008 %
0009 %    filename            spike file name (either .clu or .res)
0010 %    rate                sampling rate
0011 %
0012 %  OUTPUT
0013 %
0014 %    The output is a list of (timestamp,group,cluster) t-uples.
0015 %
0016 %  SEE
0017 %
0018 %    See also GetSpikeTimes, PlotTicks.
0019 
0020 % Copyright (C) 2004-2011 by Michaƫl Zugaro
0021 %
0022 % This program is free software; you can redistribute it and/or modify
0023 % it under the terms of the GNU General Public License as published by
0024 % the Free Software Foundation; either version 3 of the License, or
0025 % (at your option) any later version.
0026 
0027 [path,basename,extension] = fileparts(filename);
0028 if isempty(path), path = '.'; end
0029 
0030 electrodeGroup = str2num(extension(2:end));
0031 [~,basename] = fileparts(basename);
0032 
0033 % Load .res file
0034 filename = [path '/' basename '.res.' int2str(electrodeGroup)];
0035 if ~exist(filename),
0036     error(['File ''' filename ''' not found.']);
0037 end
0038 res = load(filename);
0039 
0040 % Load .clu file
0041 filename = [path '/' basename '.clu.' int2str(electrodeGroup)];
0042 if ~exist(filename),
0043     error(['File ''' filename ''' not found.']);
0044 end
0045 clu = load(filename);
0046 
0047 times = [res/rate electrodeGroup*ones(size(res)) clu(2:end)];
0048

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005