Add 3 to the values of x that are even
Afficher commentaires plus anciens
x=[7 6 1 2 0 -1 4 3 -2 0]
how do I do this in smart short way?
Réponse acceptée
Plus de réponses (2)
Arash
le 11 Oct 2011
0 votes
Walter Roberson
le 11 Oct 2011
x = x + 3 * ~mod(x,2);
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!