convert vector to matrix

16 ビュー (過去 30 日間)
Maina Kerbrat
Maina Kerbrat 2018 年 10 月 31 日
回答済み: Star Strider 2018 年 10 月 31 日
Hi all, I would like to convert a vector
A = [1,2,3,4,5,6]
to
matrix like that:
B=
[1 2 3,
4 5 6]
I tried to use reshape and I don't have vec2mat function. Do you have an idea? thank you

採用された回答

Star Strider
Star Strider 2018 年 10 月 31 日
Try this:
A = [1,2,3,4,5,6];
B = reshape(A(:), 3, []).'
B =
1 2 3
4 5 6

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by