Group values of one column based of the values of another
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all,
I have a two column matrix, I would like to group y such that if x isbetween 0 and 0.7 then corresponding y values belong to subarray 1, if x isbetween 0.8 and 1.4, then corresponding y values belong to subarray 2 and so on. How can I go about this. Thanks in advance
sample from matrix [x y]=
0 0.2954
0.1000 0.0861
0.2000 -0.0204
0.3000 0.0046
0.4000 0.2297
0.5000 0.7651
0.6000 -0.4482
0.7000 -1.2974
0.8000 0.3673
0.9000 -0.7759
1.0000 0.5676
1.1000 1.0851
1.2000 0.4082
1.3000 0.3364
1.4000 -0.3396
1.5000 -0.1935
1.6000 0.5228
0 Kommentare
Akzeptierte Antwort
KSSV
am 25 Jul. 2020
If (x,y) are two column arrays you have. You can get values lying in between two values using:
idx = x>=0.8 & X<1.4 ;
y1 = y(idx) ;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!