Reshape row vector with given number of column

2 ビュー (過去 30 日間)
Dinh Le Dung
Dinh Le Dung 2022 年 4 月 30 日
コメント済み: Dinh Le Dung 2022 年 5 月 1 日
I try to turn a row vector into a new vector with a given number of column:
Ex: A = [1,2,3,4,5,6] , col = 3
Output would be
B = [1,2,3;4,5,6]
I try to use "reshape" but the output is [1,3,5;2,4,6] as not what i want

採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 30 日
A = [1,2,3,4,5,6] , col = 3
A = 1×6
1 2 3 4 5 6
col = 3
B = reshape(A, col, []).'
B = 2×3
1 2 3 4 5 6
  1 件のコメント
Dinh Le Dung
Dinh Le Dung 2022 年 5 月 1 日
Thanks for your help!!

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

その他の回答 (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