Group values of one column based of the values of another
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
KSSV
2020 年 7 月 25 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!