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 日

0 投票

Try this:
A = [1,2,3,4,5,6];
B = reshape(A(:), 3, []).'
B =
1 2 3
4 5 6

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

質問済み:

2018 年 10 月 31 日

回答済み:

2018 年 10 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by