How to filter a certain range of values

2 vues (au cours des 30 derniers jours)
Long
Long le 27 Sep 2023
Hi, i would like to ask how to filt both row had value in range of 100 to 1500
Thanks a lot

Réponses (1)

Star Strider
Star Strider le 27 Sep 2023
I am not certain what you mean by ‘filt’ since I do not know if you want to keep those values or exclude them.
M1 = readmatrix('myfile.csv')
M1 = 2×1881
1.0e+03 * 0.0510 0.0523 0.0536 0.0549 0.0562 0.0575 0.0588 0.0601 0.0614 0.0627 0.0640 0.0653 0.0666 0.0679 0.0692 0.0705 0.0718 0.0731 0.0744 0.0757 0.0769 0.0782 0.0795 0.0808 0.0821 0.0834 0.0847 0.0860 0.0873 0.0886 1.8193 1.9286 1.9640 2.0038 1.9259 1.9580 1.9031 1.9197 1.9268 1.9583 2.0322 2.0848 2.0558 2.1367 2.0390 1.9089 1.8051 1.6918 1.6516 1.5153 1.4995 1.4243 1.4905 1.4747 1.4490 1.4592 1.4466 1.4425 1.4285 1.4708
Lv1 = M1>=100 & M1 <=150; % Logical Vector
Columns_Meeting_Criteria = M1(:,(Lv1(1,:) | Lv1(2,:)))
Columns_Meeting_Criteria = 2×135
1.0e+03 * 0.1002 0.1015 0.1028 0.1041 0.1054 0.1067 0.1079 0.1092 0.1105 0.1118 0.1131 0.1144 0.1157 0.1169 0.1182 0.1195 0.1208 0.1221 0.1233 0.1246 0.1259 0.1272 0.1285 0.1298 0.1310 0.1323 0.1336 0.1349 0.1361 0.1374 1.5082 1.5417 1.5851 1.6449 1.6249 1.6778 1.7673 1.8577 1.8910 2.0077 2.1075 2.1553 2.3087 2.3624 2.4076 2.4052 2.3749 2.3452 2.3057 2.1448 2.0659 1.9575 1.8625 1.7001 1.5737 1.4311 1.3182 1.1818 1.0848 0.9875
Columns_Not_Meeting_Criteria = M1(:,~(Lv1(1,:) | Lv1(2,:)))
Columns_Not_Meeting_Criteria = 2×1746
1.0e+03 * 0.0510 0.0523 0.0536 0.0549 0.0562 0.0575 0.0588 0.0601 0.0614 0.0627 0.0640 0.0653 0.0666 0.0679 0.0692 0.0705 0.0718 0.0731 0.0744 0.0757 0.0769 0.0782 0.0795 0.0808 0.0821 0.0834 0.0847 0.0860 0.0873 0.0886 1.8193 1.9286 1.9640 2.0038 1.9259 1.9580 1.9031 1.9197 1.9268 1.9583 2.0322 2.0848 2.0558 2.1367 2.0390 1.9089 1.8051 1.6918 1.6516 1.5153 1.4995 1.4243 1.4905 1.4747 1.4490 1.4592 1.4466 1.4425 1.4285 1.4708
Lv2 = Lv1(1,:) & Lv1(2,:);
NumIdx = find(Lv2)
NumIdx = 1×0 empty double row vector
No columns meet both criteria.
.

Catégories

En savoir plus sur Create Block Masks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by