Separating a one row matirix into many one row matricies by identifying large spikes

I am trying to find an efficent way to separate my very long, one row matirix into 18 different rows based on jumps in data. for example if
X = [1 1 1.3 1.2 14 13 14.3 5 5.1 5 20 21 20.5]
I would want to divide it into
X1 = [1 1 1.3] X2 = [14 13 14.3] X3 = [5 5.1 5] X4 = [20 21 20.5]
any suggestions would help!
THANKS!

Answers (1)

Here is an example illustrating one way to do it:
X1 = X(X<5) ;
X2 = X(X>=10 & X<20) ;
X3 = X(X>=5 & X<10) ;
X4 = X(X>=20) ;
Note: if you don't know the thresholds a priori and you need to compute them, we can discuss a solution based on ABS, DIFF, SORT, etc..

Categories

Asked:

on 18 Mar 2013

Community Treasure Hunt

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

Start Hunting!