Effacer les filtres
Effacer les filtres

Replace array elemtens, that match the condition

1 vue (au cours des 30 derniers jours)
Alexander Donner
Alexander Donner le 28 Jan 2018
Hey guys,
I have an array with x= 1:1:100; and i want to replace every element that is <= than 10 with 0.
My thought was to us the "if" function under an "for" loop, but i dont realy know how to do that.
i hope you guys can help me with that.
Thanks in advance.

Réponse acceptée

Srikanth Sedimbi
Srikanth Sedimbi le 31 Jan 2018
Try logical indexing
x(x<=10) = 0

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by