フィルターのクリア

Problem with ismember function

12 ビュー (過去 30 日間)
Kyana Shayan
Kyana Shayan 2017 年 6 月 26 日
コメント済み: Stephen23 2017 年 6 月 26 日
Dear all, Hello,
I am writing a simple function of ismember to check if an element in one matrix matches the one in another matrix, however it returns 0, although I am sure the value matches. Assume I have a array of "omega". The third element is equal to 0.1047. And I have another matrix "wt", with first element, 0.1047 and when I write
z=ismember(omega,wt,'rows')
it returns a zero at z(3). Hence, I have:
omega(3)=0.1047;
wt(1)=0.1047;
I expect:
z(3)=1;
but it gives:
z(3)=0;
I must say that it returns 1 for omega(4) which is 0.1571 and equals the wt(2).
Thank you for your help.
Cheers,
  2 件のコメント
Jan
Jan 2017 年 6 月 26 日
Test this manually:
omega(3) - wt(1)
Is this really exactly 0? Note that the limited output of numbers in Matlab's command window let 0.1047 and 0.104699999999999 appear equally, althout the numbers are different.
Stephen23
Stephen23 2017 年 6 月 26 日

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

採用された回答

Andrei Bobrov
Andrei Bobrov 2017 年 6 月 26 日
編集済み: Andrei Bobrov 2017 年 6 月 26 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by