Hi, i need to form a matrix using this vector a=[ 1 2 3 5 6 7 8 9 2 1 2], the matrix elements be A=[1 2 3 4 5 6; 7 8 9 2 1 2]
i used reshape command but it doesn't give me the sequence i want.

2 commentaires

Are you using the matrix you have given? There are only 11 elements in it. If it had 12 as I imagine it should (probably a typo).
reshape(a,2,6)
Should you give you what you want.
ala alemaryeen
ala alemaryeen le 14 Nov 2013
i am sorry it contains 12 elements. i used this command it gives A=[1 3 6 8 2 2; 2 5 7 9 1 0] i don't need this format i need the first 6 elements in the first row, and the other elements in the second row. Thanks,

Connectez-vous pour commenter.

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 14 Nov 2013

0 votes

a=[ 1 2 3 4 5 6 7 8 9 2 1 2];
reshape(a,6,2)'

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by