Help to write a simple codë to split vector to subvectors

2 ビュー (過去 30 日間)
D.Chehov
D.Chehov 2012 年 2 月 7 日
編集済み: Isaac 2013 年 10 月 3 日
Hello,
probably this question is quiet simple for this forum, but I decided to ask you!
I have Y=[Y1;Y2;Y3;Y4;Y5;Y6,...,Ym], where m is multiple of 3.
I'd like to obtain for i=1:(m/3);
y1=[Y1;Y2;Y3], y2=[Y4;Y5;Y6],....
I will appreciate any suggestion and please don't be very critical to this simple issue!
Thank you in advance!

採用された回答

Honglei Chen
Honglei Chen 2012 年 2 月 7 日
Are all Y1 through Ym equal length. If so, assume the length is N, then you can do
y = reshape(Y,3*N,[])
and each column in y corresponds to one of the subvector you want.
  1 件のコメント
D.Chehov
D.Chehov 2012 年 2 月 7 日
Thank you for teh help!The "reshape" function is suitable!
Regards

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by