Expand Elements in a Table/Matrix
古いコメントを表示
Sorry i re-post, I was not able to find an answer for this.
Let's say I have a matrix A, where the 1st row and column would be indexes.
A =
0 1 2 3
10 5 6 9
20 5 23 6
30 3 4 7
How would I expand it to all the combination of row x column values with out using loops. Like bellow:
A_Elements=
1 10 5
1 20 5
1 30 3
2 10 6
2 20 23
2 30 4
3 10 9
3 件のコメント
Walter Roberson
2011 年 5 月 16 日
What determines how often each item should be repeated?
Walter Roberson
2011 年 5 月 17 日
Should that have continued with
3 20 9
3 30 7
?
Carlos C
2011 年 5 月 17 日
採用された回答
その他の回答 (1 件)
Walter Roberson
2011 年 5 月 17 日
[reshape(repmat(A(1,2:end),size(A,1)-1,1),[],1), repmat(A(2:end,1),size(A-1)-1,1), reshape(A(2:end,2:end),[],1)]
カテゴリ
ヘルプ センター および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!