When using Corrcoef
2 次查看(过去 30 天)
显示 更早的评论
Hi all, When using corrcoef on a matrix. Is there a way to get the mean of all the values on the bottom left triangular side or the top right triangle?
All the best,
0 个评论
采纳的回答
Daniel Shub
2012-5-11
I am not sure exactly what you want ...
EDIT but not really different
N = 10;
x = randn(N);
y = corrcoef(x);
z = mean(y(tril(true(N))))
3 个评论
Daniel Shub
2012-5-11
I edited it to add the corrcoeft part and do the bottom-left and not top-right, but it doesn't change what I am doing. This what you want?
Wayne King
2012-5-11
If you don't want to average the main diagonl, which is necessarily all 1's, then use Daniel's code with
z = mean(y(tril(true(N),-1)))
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!