LoadSpikeAmplitudes - Read spike times, cluster IDs and amplitudes from disk. USAGE amplitudes = LoadSpikeAmplitudes(filename,nChannels,nSamples,peak,rate) filename spike waveform file name nChannels number of channels in electrode group nSamples number of samples per waveform peak peak sample (1..N) rate sampling rate SEE See also GetSpikeAmplitudes, LoadSpikeWaveforms.
0001 function amplitudes = LoadSpikeAmplitudes(filename,nChannels,nSamples,peak,rate) 0002 0003 %LoadSpikeAmplitudes - Read spike times, cluster IDs and amplitudes from disk. 0004 % 0005 % USAGE 0006 % 0007 % amplitudes = LoadSpikeAmplitudes(filename,nChannels,nSamples,peak,rate) 0008 % 0009 % filename spike waveform file name 0010 % nChannels number of channels in electrode group 0011 % nSamples number of samples per waveform 0012 % peak peak sample (1..N) 0013 % rate sampling rate 0014 % 0015 % SEE 0016 % 0017 % See also GetSpikeAmplitudes, LoadSpikeWaveforms. 0018 0019 % Copyright (C) 2004-2012 by Michaƫl Zugaro 0020 % 0021 % This program is free software; you can redistribute it and/or modify 0022 % it under the terms of the GNU General Public License as published by 0023 % the Free Software Foundation; either version 3 of the License, or 0024 % (at your option) any later version. 0025 0026 if nargin < 3, 0027 error('Incorrect number of parameters (type ''help <a href="matlab:help LoadSpikeAmplitudes">LoadSpikeAmplitudes</a>'' for details).'); 0028 end 0029 0030 [path,basename,extension] = fileparts(filename); 0031 if isempty(path), path = '.'; end 0032 0033 electrodeGroupStr = extension(2:end); 0034 electrodeGroup = str2num(electrodeGroupStr); 0035 [~,basename] = fileparts(basename); 0036 0037 % Times and cluster IDs 0038 times = LoadSpikeTimes(filename,rate); 0039 0040 % Load .spk file 0041 filename = [path '/' basename '.spk.' electrodeGroupStr]; 0042 if ~exist(filename), 0043 error(['File ''' filename ''' not found.']); 0044 end 0045 amp = LoadBinary(filename,'offset',peak-1,'skip',nSamples-1,'nChannels',nChannels); 0046 0047 amplitudes = [times amp];