Split data into different arrays of different sizes?

2 Ansichten (letzte 30 Tage)
pauldjn
pauldjn am 1 Okt. 2018
Kommentiert: pauldjn am 1 Okt. 2018
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"?

Antworten (2)

KSSV
KSSV am 1 Okt. 2018
If a is the vector and index is i.
iwant = a(i)
  3 Kommentare
KSSV
KSSV am 1 Okt. 2018
How your indices are given?
pauldjn
pauldjn am 1 Okt. 2018
Is a vector i = (1 2 3 4 5 6...) etc

Melden Sie sich an, um zu kommentieren.


Stephen23
Stephen23 am 1 Okt. 2018
accumarray(index(:),a(:),[],@(v){v})
  1 Kommentar
pauldjn
pauldjn am 1 Okt. 2018
I got this error message: Second input VAL must be a vector with one element for each row in SUBS, or a scalar.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by