how to convert 9*1 matrix to 3*3 matrix

9 vues (au cours des 30 derniers jours)
sunitha
sunitha le 25 Fév 2021
Modifié(e) : Stephen23 le 25 Fév 2021
I have a matrix A=[1;2;3;4;5;6;7;8;9] .i.e 9*1 ,now i want to convert 3*3 format like [ 1 4 7; 2 5 8;3 6 9] and i want to add values 1 column . how can i write the code??
  2 commentaires
Stephen23
Stephen23 le 25 Fév 2021
Modifié(e) : Stephen23 le 25 Fév 2021
A=[1;2;3;4;5;6;7;8;9]
A = 9×1
1 2 3 4 5 6 7 8 9
B = reshape(A,3,3) % removed transpose (thank you James Tursa)
B = 3×3
1 4 7 2 5 8 3 6 9
James Tursa
James Tursa le 25 Fév 2021
You don't need the .' operation.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Polynomials 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!

Translated by