issue in find variable

2 件のコメント

Muhammad Usman Gul
Muhammad Usman Gul 2020 年 7 月 22 日
Please explain to me why it gives me an empty matrix? Out of 100 only following 25 thresholds are also gives empty matrix
0.0600, 0.0700, 0.1000, 0.1500, 0.1800, 0.2100, 0.2400, 0.2900, 0.3500, 0.3600, 0.4100, 0.4200, 0.4700, 0.4800, 0.5700, 0.5800, 0.6900, 0.7000, 0.7100, 0.8200, 0.8300, 0.8400, 0.9400, 0.9500, 0.9600

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2020 年 7 月 22 日
編集済み: Fangjun Jiang 2020 年 7 月 22 日

0 投票

floating point data precision issue. Below is an example, a and b are not equal even though all the visible digits are the same.
>> format long
>> a=1-1/3
a =
0.666666666666667
>> b=2/3
b =
0.666666666666667
>> a==b
ans =
logical
0
>> abs(a-b)<=eps
ans =
logical
1

3 件のコメント

Muhammad Usman Gul
Muhammad Usman Gul 2020 年 7 月 22 日
Actually, I have a column matrix that contains different numbers between 0.001 to 1. For example, the 0.0600 value is repeated 7 times in the matrix. I would like to find out these numbers along with their indexes. I am trying to use for loop to find out where is exact number occurring. As I am facing above issue, anyone can suggest be how to extract the desire value from the matrix?
Fangjun Jiang
Fangjun Jiang 2020 年 7 月 22 日
find(abs(YouData-0.06)<=eps)
Muhammad Usman Gul
Muhammad Usman Gul 2020 年 7 月 22 日
Its work, Thanks all of you

この質問は閉じられています。

質問済み:

2020 年 7 月 22 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by