if statement on vector to replace values

Hi all,
So i'd like to change a Matrix ((86400x1 double) or vector) which contains 1 colum and 86400 rows with an if statement.
My idea is to check every value if it's smaller than 0, and if so it should be replaced by Zero.
Would be great if someone could help me.
Thanks in advance
Bene

 Respuesta aceptada

Alan Stevens
Alan Stevens el 29 de Mayo de 2020
Editada: Alan Stevens el 29 de Mayo de 2020

1 voto

If M is the vector try:
ix = (M<0); M(ix) = 0;

Más respuestas (0)

Productos

Versión

R2018b

Preguntada:

el 29 de Mayo de 2020

Editada:

el 29 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by