How to create matrix in MATLAB from an array?

How to create a matrix quickly, for example, from a consecutive sequence, like what R does?
matrix(1:12, 3, 4)
It seems doltish to input all the entries one-by-one.

 採用された回答

Andrei Bobrov
Andrei Bobrov 2017 年 9 月 22 日

0 投票

reshape(1:12, 3, [])

1 件のコメント

Stephen23
Stephen23 2017 年 9 月 22 日
編集済み: Stephen23 2017 年 9 月 22 日
or quite possibly:
reshape(1:12,[],3).'

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2017 年 9 月 22 日

編集済み:

2017 年 9 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by