Error while using variables inside "ismember"

The "ismember" function is not reading values when they are assigned to variables after simple arithmertic operations.
a=csvread('....\ATR.csv'); %it is a 230x2 array (acc. the data set I'm using)
a=unique(a,'rows','stable') %it is reduced to 176x2 array
ismember([69.7 21.5],a,'rows') % returns true as the matrix specified is in a
ismember([69.6+0.1 21.4+0.1],a,'rows') %returns false, but the data point after the arithmetic operations exists in a
ax=69.6;
ay=21.6;
ismember([ax ay],a,'rows') % returns true as the matrix specidied is in my data
ax=ax+0.1; ay=ay-0.1;
ismember([ax ay],a,'rows') % returns false but the matrix specified is in my data

3 件のコメント

Adam Danz
Adam Danz 2019 年 5 月 8 日
I bet it's a precision issue. Use ismembertol() instead.
Sarthak  De
Sarthak De 2019 年 5 月 9 日
Thanks guys, both of your inputs really helped me understand and solve the problem !

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

質問済み:

2019 年 5 月 8 日

コメント済み:

2019 年 5 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by