Split data into different arrays of different sizes?

조회 수: 2 (최근 30일)
pauldjn
pauldjn 2018년 10월 1일
댓글: pauldjn 2018년 10월 1일
Hi I have a huge vector of data and I would like to divide it into different groups according to a particular index so lets say my data is a= (1 2 3 4 5 6 7 8....) and my index is i= (1,2,3,4..) which sum is equal to the size of a. How can I split "a" vector according to the index "i"?

답변 (2개)

KSSV
KSSV 2018년 10월 1일
If a is the vector and index is i.
iwant = a(i)
  댓글 수: 3
KSSV
KSSV 2018년 10월 1일
How your indices are given?
pauldjn
pauldjn 2018년 10월 1일
Is a vector i = (1 2 3 4 5 6...) etc

댓글을 달려면 로그인하십시오.


Stephen23
Stephen23 2018년 10월 1일
accumarray(index(:),a(:),[],@(v){v})
  댓글 수: 1
pauldjn
pauldjn 2018년 10월 1일
I got this error message: Second input VAL must be a vector with one element for each row in SUBS, or a scalar.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by