PlotSpikeWaveforms - Plot spike waveforms. USAGE p = PlotSpikeWaveforms(W,<options>,<options2>) W waveforms obtained using <a href="matlab:help GetSpikeWaveforms">GetSpikeWaveforms</a> <options> optional list of property-value pairs (see table below) <options2> options for function <a href="matlab:help plot">plot</a> ========================================================================= Properties Values ------------------------------------------------------------------------- 'spacing' vertical spacing between variables (default = 5000) ========================================================================= SEE See also GetSpikeWaveforms, LoadSpikeWaveforms.
0001 function p = PlotSpikeWaveforms(W,varargin) 0002 0003 %PlotSpikeWaveforms - Plot spike waveforms. 0004 % 0005 % USAGE 0006 % 0007 % p = PlotSpikeWaveforms(W,<options>,<options2>) 0008 % 0009 % W waveforms obtained using <a href="matlab:help GetSpikeWaveforms">GetSpikeWaveforms</a> 0010 % <options> optional list of property-value pairs (see table below) 0011 % <options2> options for function <a href="matlab:help plot">plot</a> 0012 % 0013 % ========================================================================= 0014 % Properties Values 0015 % ------------------------------------------------------------------------- 0016 % 'spacing' vertical spacing between variables (default = 5000) 0017 % ========================================================================= 0018 % 0019 % SEE 0020 % 0021 % See also GetSpikeWaveforms, LoadSpikeWaveforms. 0022 0023 % Copyright (C) 2010-2012 by Michaƫl Zugaro 0024 % 0025 % This program is free software; you can redistribute it and/or modify 0026 % it under the terms of the GNU General Public License as published by 0027 % the Free Software Foundation; either version 3 of the License, or 0028 % (at your option) any later version. 0029 0030 if nargin < 1, 0031 error('Incorrect number of parameters (type ''help <a href="matlab:help PlotSpikeWaveforms">PlotSpikeWaveforms</a>'' for details).'); 0032 end 0033 0034 % Default values 0035 spacing = []; 0036 v = {}; 0037 0038 % Parse parameter list 0039 n = 1; 0040 for i = 1:2:length(varargin), 0041 if ~ischar(varargin{i}), 0042 error(['Parameter ' num2str(i+2) ' is not a property (type ''help <a href="matlab:help PlotSpikeWaveforms">PlotSpikeWaveforms</a>'' for details).']); 0043 end 0044 switch(lower(varargin{i})), 0045 case 'spacing', 0046 spacing = varargin{i+1}; 0047 if ~isdscalar(spacing), 0048 error('Incorrect value for property ''spacing'' (type ''help <a href="matlab:help PlotSpikeWaveforms">PlotSpikeWaveforms</a>'' for details).'); 0049 end 0050 otherwise, 0051 v = varargin{i:end}; 0052 if ~isa(v,'cell'), v = {v}; end 0053 break; 0054 end 0055 end 0056 0057 if isempty(spacing), 0058 spacing = 50000; 0059 end 0060 0061 % Plot 0062 hold on; 0063 n = size(W,2); 0064 for i = 1:n, 0065 plot(spacing*(n-i)+permute(squeeze(W(:,i,:)),[2 1]),v{:}); 0066 end