0001 function PlotCCG(t,ccg,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 full = false;
0033
0034 if nargin < 2,
0035 error('Incorrect number of parameters (type ''help <a href="matlab:help PlotCCG">PlotCCG</a>'' for details).');
0036 end
0037
0038 if ~isdvector(t),
0039 error('Incorrect times bins (type ''help <a href="matlab:help PlotCCG">PlotCCG</a>'' for details).');
0040 end
0041 if length(t) ~= size(ccg,1),
0042 error('Inconsistent time bins and cross-correlogram data (type ''help <a href="matlab:help PlotCCG">PlotCCG</a>'' for details).');
0043 end
0044
0045
0046 for i = 1:2:length(varargin),
0047 if ~ischar(varargin{i}),
0048 error(['Parameter ' num2str(i+2) ' is not a property (type ''help <a href="matlab:help CCG">CCG</a>'' for details).']);
0049 end
0050 switch(lower(varargin{i})),
0051 case 'full',
0052 full = lower(varargin{i+1});
0053 if ~isastring(full,'on','off'),
0054 error('Incorrect value for property ''full'' (type ''help <a href="matlab:help CCG">CCG</a>'' for details).');
0055 end
0056 full = strcmp(full,'on');
0057 otherwise,
0058 error(['Unknown property ''' num2str(varargin{i}) ''' (type ''help <a href="matlab:help CCG">CCG</a>'' for details).']);
0059 end
0060 end
0061
0062 [~,nCols,nRows] = size(ccg);
0063 if nCols ~= nRows && ~full,
0064 warning('Unequal numbers of rows and columns - forcing ''full'' mode');
0065 full = true;
0066 end
0067
0068 if full,
0069 for col = 1:nCols,
0070 for row = 1:nRows,
0071 subplot(nRows,nCols,col+nCols*(nRows-row));
0072 b = bar(t,ccg(:,col,row));
0073 xlim([min(t) max(t)]);
0074 set(b,'EdgeColor','k','FaceColor','k');
0075 if col == 1,
0076 ylabel(int2str(row));
0077 end
0078 end
0079 if col == row,
0080 xlabel('Time (s)');
0081 else
0082 set(gca,'xtick',[]);
0083 end
0084 if row == nRows,
0085 title(int2str(col));
0086 end
0087 end
0088 else
0089 n = size(ccg,2);
0090 for col = 1:n,
0091 for row = col:n,
0092 subplot(n,n,col+n*(n-row));
0093 b = bar(t,ccg(:,col,row));
0094 xlim([min(t) max(t)]);
0095 if col == row,
0096 set(b,'EdgeColor','none','FaceColor','b');
0097 else
0098 set(b,'EdgeColor','k','FaceColor','k');
0099 end
0100 if col == 1,
0101 ylabel(int2str(row));
0102 end
0103 end
0104 if col == row,
0105 xlabel('Time (s)');
0106 else
0107 set(gca,'xtick',[]);
0108 end
0109 if row == n,
0110 title(int2str(col));
0111 end
0112 end
0113 end
0114
0115