Rearranging values in a matrix
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matrix that has 4 columns and I would like to rearrange it to have 5 columns so that the value in the second row first column becomes the value in the first row fifth column. So if the matrix was:
[1 2 3 4
5 1 2 3
4 5 1 2
3 4 5 1
2 3 4 5]
It would become:
[1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5]
Does anybody know how I could do this? Thanks in advance!
0 件のコメント
回答 (1 件)
Von Duesenberg
2018 年 3 月 11 日
Suppose your initial matrix is called oldMat:
reshape(oldMat', [5, 4])'
3 件のコメント
参考
カテゴリ
Help Center および 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!