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

245 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Adam Danz
Adam Danz il 13 Set 2020
Modificato: Adam Danz il 13 Set 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 Commenti

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by