Function(vecnorm) name conflict
SuhwanGim opened this issue · 0 comments
SuhwanGim commented
Hi,
I got error message when I ran the function corr
wiht multiple columns ( e.g., corr(randn(50,2), randn(50,4))
) in MATLAB after 2018b version.
error message here:
Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other.Error in corr>corrPearson (line 307)
coef = bsxfun(@RDivide,coef,dx'); coef = bsxfun(@RDivide,coef,dy); % coef = coef ./ dx'*dy;
I think it is due to the same function name vecnorm
.
After MATLAB 2018 version, they made built-in function MATLAB/vecnorm
, and they start to implement 'vecnorm' in 'corr' .
From line 303 in corr>corrPearson
y = bsxfun(@minus,y,sum(y,1)/n); % Remove mean coef = x' * y; % 1/(n-1) doesn't matter, renormalizing anyway dx = vecnorm(x,2,1); dy = vecnorm(y,2,1); coef = bsxfun(@rdivide,coef,dx'); coef = bsxfun(@rdivide,coef,dy); % coef = coef ./ dx'*dy;
So, I think 'vecnorm' in this toolbox will change the name for potential conflicts.
Thanks.
Suhwan Gim