row location info from matrix

1 vue (au cours des 30 derniers jours)
young jin Kwak
young jin Kwak le 24 Nov 2016
I have 500*4 matrix and I want to find the row location where it holds the value I want. The problem is that there is some point that has the same value for different row. For example, my data would contain
.......
.......
.......
0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 (139th)
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 (140th)
0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 (141th)
.........
I want to get location of row where its 2nd component is in range of 0.53< 2ndComponent < 0.54,
3rd component is in range of 0.106< 3rdComponent <0.0107,
and minimum location value of number, so that it would come out to be 140 for this case.

Réponses (3)

KSSV
KSSV le 24 Nov 2016
You can achieve your task with find. doc find.

Image Analyst
Image Analyst le 24 Nov 2016
Try ismembertol()

Guillaume
Guillaume le 24 Nov 2016
This is simply combining comparisons:
row = find(yourmatrix(:, 2) > 0.53 & yourmatrix(:, 2) < 0.54 & ...
yourmatrix(:, 3) > 0.106 & yourmatrix(:, 3) < 0.107, 1)

Catégories

En savoir plus sur Matrices and Arrays 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