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

245 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Adam Danz
Adam Danz el 13 de Sept. de 2020
Editada: Adam Danz el 13 de Sept. de 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 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by