How can I change the elements to zero when they are less than specific threshold

246 ビュー (過去 30 日間)
I have A = [1,10,4,8,25,80,1,4,8]
I want to put zerpo those elements which are less than 5
in fact, 5 is my threshold

採用された回答

Adam Danz
Adam Danz 2020 年 9 月 13 日
編集済み: Adam Danz 2020 年 9 月 13 日
A(A<5) = 0;
A(A<=5) = 0;
B = A .* double(A>5);
B = A .* double(A>=5);
Try them out and choose one.
  3 件のコメント
Milad Naderloo
Milad Naderloo 2020 年 9 月 13 日
Thanks a lot, it works now!
Milad Naderloo
Milad Naderloo 2020 年 9 月 13 日
Both works

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by