function R = cov2cor(S) % usage: R = cov2cor(S) % description: computes the correlation matrix % R from the input covariance matrix S, assuming % all diagonal entries of S are positive. % programmer: t. shores last rev: 8/09/07 Dinv = diag(diag(S))^(-0.5); R = Dinv*S*Dinv;