Home > FMAToolbox > IO > LoadSpikeFeatures.m

LoadSpikeFeatures

PURPOSE ^

LoadSpikeFeatures - Load spike times, cluster IDs and features from disk.

SYNOPSIS ^

function features = LoadSpikeFeatures(filename,rate)

DESCRIPTION ^

LoadSpikeFeatures - Load spike times, cluster IDs and features from disk.

  USAGE

    features = LoadSpikeFeatures(filename,rate)

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

  OUTPUT

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

  SEE

    See also GetSpikeFeatures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function features = LoadSpikeFeatures(filename,rate)
0002 
0003 %LoadSpikeFeatures - Load spike times, cluster IDs and features from disk.
0004 %
0005 %  USAGE
0006 %
0007 %    features = LoadSpikeFeatures(filename,rate)
0008 %
0009 %    filename            spike file name (either .clu, .res or .fet)
0010 %    rate                sampling rate
0011 %
0012 %  OUTPUT
0013 %
0014 %    The output is a list of (timestamp,group,cluster,features...) t-uples.
0015 %
0016 %  SEE
0017 %
0018 %    See also GetSpikeFeatures.
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 .clu file
0034 filename = [path '/' basename '.clu.' int2str(electrodeGroup)];
0035 if ~exist(filename),
0036     error(['File ''' filename ''' not found.']);
0037 end
0038 clu = load(filename);
0039 clu = clu(2:end);
0040 
0041 % Load .fet file
0042 filename = [path '/' basename '.fet.' int2str(electrodeGroup)];
0043 if ~exist(filename),
0044     error(['File ''' filename ''' not found.']);
0045 end
0046 file = fopen(filename,'r');
0047 if file == -1,
0048     error(['Cannot open file ''' filename '''.']);
0049 end
0050 nFeatures = fscanf(file,'%d',1);
0051 fet = fscanf(file,'%f',[nFeatures,inf])';
0052 fclose(file);
0053 
0054 features = [fet(:,end)/rate electrodeGroup*ones(size(clu)) clu fet(:,1:end-1)];
0055

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