problem using the find function

hi, i'm trying to use the find function to locate specific values form matrix array and to remove them (as you can see in the attached m-file) https://www.dropbox.com/s/bcynkiblh7n8tr5/check_values_s_ds_script.m
i use the function like this:
[row,col] = find(resault>0.899 & resault < 1);
but still i find values that are greater then 1 (some are even 50) what am i doing wrong?

4 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 3 日
Kobi commented
ok but the find function dosn't seem to find only the values between 0.889 to 1, you can see in the plot (colorbar) that i recive the location of a variable that is way greater then 1.
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 3 日
This is not true. How can we see it in a figure?
Kobi
Kobi 2014 年 2 月 3 日
the colorbar shows the number 35 in red as the highest value also i can see red dots and in the matrix on those locations (columns and rows) there are number greater then 1
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 3 日
I don't know how you got those figures, but I can assure you that
row,col] = find(resault>0.899 & resault < 1)
will find only location of numbers that are between 0.899 and 1

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

 採用された回答

Kobi
Kobi 2014 年 2 月 4 日

0 投票

i found the problem i have been using find function the wrong way by changing the output to just one (index of matrix) the function give me the correct location of each and every value

その他の回答 (2 件)

Amit
Amit 2014 年 2 月 3 日

0 投票

row and col are the indices in the matrix which have the value you need. Find function just finds the indices which satisfy the condition, however find function does not replaces those values.
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 3 日
編集済み: Azzi Abdelmalek 2014 年 2 月 3 日

0 投票

What you want is
resault(resault>0.899 & resault < 1)
Maybe what you mean by remove them
resault(resault>0.899 & resault < 1)=0
Removing an element doesn't mean set it to zero. Also you can't remove a element from a nxm matrix, you can remove an entire column or row.

1 件のコメント

per isakson
per isakson 2014 年 2 月 4 日
or
resault(resault>0.899 & resault < 1) = nan;

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

カテゴリ

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

製品

タグ

質問済み:

2014 年 2 月 3 日

回答済み:

2014 年 2 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by