Home > chronux_code > exploratory > correlations > helper > check_consistency.m

check_consistency

PURPOSE ^

Helper routine to check consistency of data dimensions

SYNOPSIS ^

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

DESCRIPTION ^

 Helper routine to check consistency of data dimensions
 Usage: check_consistency(data1,data2)
 Inputs:
 data1 - first dataset
 data2 - second dataset
 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,N2,C1,C2]=check_consistency(data1,data2)
0002 % Helper routine to check consistency of data dimensions
0003 % Usage: check_consistency(data1,data2)
0004 % Inputs:
0005 % data1 - first dataset
0006 % data2 - second dataset
0007 % Outputs:
0008 % Dimensions of the datasets - data1 - (N1,C1) and data2-(N2,C2)
0009 % N1 and/or N2 left empty for structure arrays
0010 N1=[]; N2=[];
0011 if isstruct(data1);
0012     C1=length(data1);
0013 else;
0014     [N1,C1]=size(data1);
0015 end;
0016 if isstruct(data2);
0017     C2=length(data2);
0018 else;
0019     [N2,C2]=size(data2);
0020 end;
0021 if C1~=C2; error('inconsistent dimensions'); end;
0022 if ~isstruct(data1) & ~isstruct(data2);
0023     if N1~=N2; error('inconsistent dimensions'); end;
0024 end;

Generated on Tue 07-Jun-2005 12:20:32 by m2html © 2003