row location info from matrix

1 回表示 (過去 30 日間)
young jin Kwak
young jin Kwak 2016 年 11 月 24 日
回答済み: Guillaume 2016 年 11 月 24 日
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.

回答 (3 件)

KSSV
KSSV 2016 年 11 月 24 日
You can achieve your task with find. doc find.

Image Analyst
Image Analyst 2016 年 11 月 24 日
Try ismembertol()

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

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by