Dividing a vector into a matrix

1 回表示 (過去 30 日間)
Colt Davis
Colt Davis 2015 年 3 月 19 日
編集済み: Andrei Bobrov 2015 年 3 月 20 日
I have a vector that has 40755 entries. I need to make this a multidimensional matrix where a new row is started every sixteenth entry. Any ideas? ex)
vector = [1,2,3,4,5,6,7,8,9,10,11,12]
split this up every third element
matrix [1,2,3
4,5,6
7,8,9,
10,11,12]

採用された回答

Star Strider
Star Strider 2015 年 3 月 20 日
The reshape function is your friend!
I have no idea what shape you want your result matrix to be (it’s not clear from your question), so I can’t provide specific code. (The length of your vector is not evenly divisible by (12*16), so you have to be more specific with respect to what you want reshape to produce.)

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