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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by