plotting information that is above a certain threshold

If I have a dataset and I want to threshold it I use
thresh = find(dataset > 100)
however, if I want to plot 'thresh' how would I go about this as I know that the find function just gives the indicies at which these values occur.

 採用された回答

Thorsten
Thorsten 2013 年 1 月 22 日

0 投票

If you want to plot the data above threshold, you can use
dataset_new = dataset(find(dataset > 100));
plot(dataset_new)

5 件のコメント

Bran
Bran 2013 年 1 月 22 日
Thank you Thorsten this is just what I needed :)
Image Analyst
Image Analyst 2013 年 1 月 23 日
The find() is not needed at all. This works with logical indexing:
dataset_new = dataset(dataset > 100)
No need to convert the logical indexes to actual numerical indexes.
Safwan
Safwan 2016 年 11 月 13 日
By doing this, it will remove all the data below the threshold value. Would it be possible to change the data below threshold value to zero instead of removing them?
Image Analyst
Image Analyst 2016 年 11 月 14 日
Yes.
yourData(yourData < thresholdValue) = 0;
Image Analyst
Image Analyst 2016 年 11 月 14 日
You need to put dataset_new on the left hand side:
x = Data_Bushing1(:, 1); % import Y of column 1 from Data_Bushing1
x(x > -2 & x < 2) = 0; % set values in between threshold value to zeros
dataset_new = x;
stem(dataset_new)
x will already have the values in the threshold range zeroed out, which is what you want. So all you have to do is assign it to a new variable, if you even want a new variable. Otherwise you can just use x as-is.

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

その他の回答 (0 件)

カテゴリ

質問済み:

2013 年 1 月 22 日

コメント済み:

2016 年 11 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by