Trying to make every odd number zero in a vector
Ältere Kommentare anzeigen
I have a variable x = 1:100;
I am trying to make the y have every odd number be zero, how do I do that?
Antworten (1)
Bhaskar R
am 5 Dez. 2019
x(find(mod(x, 2))) = 0;
or
x(1:2:end) = 0;
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!