# check_consistency

## PURPOSE

Helper routine to check consistency of data dimensions

## SYNOPSIS

function [N,C]=check_consistency(data1,data2,sp)

## DESCRIPTION

     Helper routine to check consistency of data dimensions
     Usage: [N,C]=check_consistency(data1,data2,sp)
     Inputs:
     data1 - first dataset
     data2 - second dataset
     sp - optional argument to be input as 1 when one of the two data sets is
     spikes times stored as a 1d array.
     Outputs:
     Dimensions of the datasets - data1 or data2 (note that
        routine stops with an error message if dimensions don't match - [N,C]
        N left empty for structure arrays

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- coherencyc Multi-taper coherency,cross-spectrum and individual spectra - continuous process
- coherencysegc Multi-taper coherency, cross-spectrum and individual spectra with segmenting - continuous process
- cohgramc Multi-taper time-frequency coherence,cross-spectrum and individual spectra - continuous processes
- coherencycpb Multi-taper coherency,cross-spectrum and individual spectra - continuous and binned point process data
- coherencycpt Multi-taper coherency,cross-spectrum and individual spectra -continuous data and point process as times
- coherencysegcpb Multi-taper coherency,cross-spectrum and individual spectra with segmenting
- coherencysegcpt Multi-taper coherency,cross-spectrum and individual spectra computed by segmenting
- cohgramcpb Multi-taper time-frequency coherence,cross-spectrum and individual spectra
- cohgramcpt Multi-taper time-frequency coherence,cross-spectrum and individual spectra
- plotsigdiff Function to plot significant differences between two time-frequency arrays X1 and X2
- coherencypb Multi-taper coherency,cross-spectrum and individual spectra - binned point process
- coherencysegpb Multi-taper coherency,cross-spectrum and individual spectra computed by segmenting
- cohgrampb Multi-taper time-frequency coherence,cross-spectrum and individual spectra - two binned point processes
- coherencypt Multi-taper coherency - point process times
- coherencysegpt Multi-taper coherency computed by segmenting two univariate point processes into chunks
- cohgrampt Multi-taper time-frequency coherence - two point processes given as times

## SOURCE CODE

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