Matrix Reshaping 9x9 to 3x27
1 回表示 (過去 30 日間)
古いコメントを表示
Rahul Marwaha
2022 年 10 月 24 日
回答済み: RAGHUNATHRAJU DASHARATHA
2022 年 10 月 24 日
Hi I'm struggling with converting a computed 9 x 9 matrix into the form of a 3x27 matrix. An exmaple of the 9x9 is given below:
8 1 4 7 9 1 2 4 9
6 1 2 7 1 4 8 1 5
5 5 8 5 4 3 6 3 5
9 8 3 1 1 8 5 2 4
3 9 5 3 9 4 2 2 9
7 2 2 9 1 9 8 3 4
7 6 6 2 7 2 6 4 2
4 5 3 8 8 3 4 1 8
6 1 6 5 8 2 5 9 4
I would like to take the first three values of each column and use that as the columns of the new 3x27 matrix. This would be repeated for all nine values in each column to create a matrix based off the one above to look like:
8 9 7 1 8 6 4 3 6
6 3 4 1 9 5 2 5 3 etc
5 7 6 5 2 1 8 2 6
Any help or guidance would be much appreciated!
0 件のコメント
採用された回答
Arif Hoq
2022 年 10 月 24 日
A=[8 1 4 7 9 1 2 4 9
6 1 2 7 1 4 8 1 5
5 5 8 5 4 3 6 3 5
9 8 3 1 1 8 5 2 4
3 9 5 3 9 4 2 2 9
7 2 2 9 1 9 8 3 4
7 6 6 2 7 2 6 4 2
4 5 3 8 8 3 4 1 8
6 1 6 5 8 2 5 9 4];
output=reshape(A(:),3,[])
0 件のコメント
その他の回答 (1 件)
RAGHUNATHRAJU DASHARATHA
2022 年 10 月 24 日
As per my understanding you want to convert a 9x9 matric to 3x27 matix.
I will try to explain it using an example below
a=[8 1 4 7 9 1 2 4 9
6 1 2 7 1 4 8 1 5
5 5 8 5 4 3 6 3 5
9 8 3 1 1 8 5 2 4
3 9 5 3 9 4 2 2 9
7 2 2 9 1 9 8 3 4
7 6 6 2 7 2 6 4 2
4 5 3 8 8 3 4 1 8
6 1 6 5 8 2 5 9 4];
b=reshape(a,[3,27])
For any further information you can go through the link
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!