correlation matrix labels
1 回表示 (過去 30 日間)
古いコメントを表示
Assume I have:
names = { 'one', 'two', 'three' };
How could i generate the matrix:
'one vs one' 'one vs two' 'one vs three'
'two vs one' 'two vs two' 'two vs three'
'three vs one' 'three vs two' 'three vs three'
(without a nested for loop of course)
0 件のコメント
採用された回答
Daniel Shub
2012 年 5 月 24 日
names = {'one', 'two', 'three'};
middle = {' vs '};
N = length(names);
reshape(strcat({names{repmat(1:N, N, 1)}}, middle, {names{repmat(1:N, N, 1)'}}), N, N)'
ans =
'one vs one' 'one vs two' 'one vs three'
'two vs one' 'two vs two' 'two vs three'
'three vs one' 'three vs two' 'three vs three'
0 件のコメント
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!