Matrix Reshaping 9x9 to 3x27
3 次查看(过去 30 天)
显示 更早的评论
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 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!