Matrix Reshaping 9x9 to 3x27
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Rahul Marwaha
le 24 Oct 2022
Réponse apportée : RAGHUNATHRAJU DASHARATHA
le 24 Oct 2022
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 commentaires
Réponse acceptée
Arif Hoq
le 24 Oct 2022
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 commentaires
Plus de réponses (1)
RAGHUNATHRAJU DASHARATHA
le 24 Oct 2022
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 commentaires
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!