Home > chronux_0.5 > helper > check_consistency.m

check_consistency

PURPOSE ^

Helper routine to check consistency of data dimensions

SYNOPSIS ^

function [N1,C1,N2,C2]=check_consistency(data1,data2,sp)

DESCRIPTION ^

 Helper routine to check consistency of data dimensions
 Usage: [N1,C1,N2,C2]=check_consistency(data1,data2,sp)
 Inputs:
 data1 - first dataset
 data2 - second dataset
 sp - optional argument to be input as 0 when one of the two data sets is
 spikes times stored as a 1d array.
 Outputs:
 Dimensions of the datasets - data1 - (N1,C1) and data2-(N2,C2)
 N1 and/or N2 left empty for structure arrays

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [N1,C1,N2,C2]=check_consistency(data1,data2,sp)
0002 % Helper routine to check consistency of data dimensions
0003 % Usage: [N1,C1,N2,C2]=check_consistency(data1,data2,sp)
0004 % Inputs:
0005 % data1 - first dataset
0006 % data2 - second dataset
0007 % sp - optional argument to be input as 0 when one of the two data sets is
0008 % spikes times stored as a 1d array.
0009 % Outputs:
0010 % Dimensions of the datasets - data1 - (N1,C1) and data2-(N2,C2)
0011 % N1 and/or N2 left empty for structure arrays
0012 N1=[]; N2=[];
0013 if nargin < 3 || isempty(sp); sp=0; end;
0014 if isstruct(data1);
0015     C1=length(data1);
0016 else
0017     [N1,C1]=size(data1);
0018 end;
0019 if isstruct(data2);
0020     C2=length(data2);
0021 else
0022     [N2,C2]=size(data2);
0023 end;
0024 if C1~=C2; error('inconsistent dimensions'); end;
0025 if sp==0;
0026    if ~isstruct(data1) && ~isstruct(data2);
0027       if N1~=N2; error('inconsistent dimensions'); end;
0028    end;
0029 end;

Generated on Tue 16-Aug-2005 21:33:45 by m2html © 2003