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

236 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Adam Danz
Adam Danz le 13 Sep 2020
Modifié(e) : Adam Danz le 13 Sep 2020
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 commentaires

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by