MATCORR Find matching rows in two matrices and their corrs. Uses the Hungarian (default), VAM, or maxcorr assignment methods. (Follow with matperm to permute and sign x -> y).

Usage: >> [corr,indx,indy,corrs] = matcorr(x,y,rmmean,method,weighting);

Inputs:
x   
first input matrix
y   
matrix with same number of columns as x

Optional inputs:
rmmean   
When present and non-zero, remove row means prior to correlation {default: 0}
method   
Method used to find assignments. 0= Hungarian Method - maximize sum of abs corrs {default: 0} 1= Vogel's Assignment Method -find pairs in order of max contrast 2= Max Abs Corr Method - find pairs in order of max abs corr Note that the methods 0 and 1 require matrices to be square.
weighting   
An optional weighting matrix size(weighting) = size(corrs) that weights the corrs matrix before pair assignment {def: 0/[]->ones()}

Outputs:
corr   
a column vector of correlation coefficients between best-correlating rows of matrice x and y
indx   
a column vector containing the index of the maximum abs-correlated x row in descending order of abs corr (no duplications)
indy   
a column vector containing the index of the maximum abs-correlated row of y in descending order of abs corr (no duplications)
corrs   
an optional square matrix of row-correlation coefficients between matrices x and y

Note: outputs are sorted by abs(corr)

Authors: Scott Makeig & Sigurd Enghoff, SCCN/INC/UCSD, La Jolla, 11-30-96

See the matlab file matcorr.m (may require other functions)

Back to functions