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 件のコメント

jnaumann
jnaumann 2013 年 11 月 14 日
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 2013 年 11 月 14 日
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,

サインインしてコメントする。

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 14 日

0 投票

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

1 件のコメント

ala alemaryeen
ala alemaryeen 2013 年 11 月 14 日
Thanks, that give me the result

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by