Replace even element with zero
27 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi.
I am trying to replace even elements in my matrix with zero like below:
a = [3 5 4 1 2]
enter magical code here
a = [3 5 0 1 0]
Any help would be greatly appreciated
1 comentario
Stephen23
el 22 de Nov. de 2020
Editada: Stephen23
el 22 de Nov. de 2020
Original question by Giovanni Rodriguez:
Replace even element with zero
Hi.
I am trying to replace even elements in my matrix with zero like below:
a = [3 5 4 1 2]
enter magical code here
a = [3 5 0 1 0]
Any help would be greatly appreciated
Respuestas (1)
KALYAN ACHARJYA
el 22 de Nov. de 2020
Editada: KALYAN ACHARJYA
el 22 de Nov. de 2020
"I am trying to replace even elements in my matrix with zero like below:"
a(2:2:end)=0
But the example is different ??
a = [3 5 0 1 0]
2 comentarios
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!