Matrix Reshaping 9x9 to 3x27
조회 수: 1 (최근 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에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!