function [RWScorr] = CorrByRWS(a) %calculate the corr of the RWS output (topological profile). Change the code to use the come-in(default) profile and go-out profile.
%by Chengwei Lei, UTSA, San Antonio, TX, USA, http://my.cs.utsa.edu/~clei
RWS1=RWS(a);

RWScorr=corr(RWS1)
%RWS2=RWS1-ones(size(median(RWS1(:,:))))'*median(RWS1(:,:));
%RWScorr=corr(RWS2');


RWScorr(isnan(RWScorr))=0;