Add 3 to the values of x that are even
Mostrar comentarios más antiguos
x=[7 6 1 2 0 -1 4 3 -2 0]
how do I do this in smart short way?
Respuesta aceptada
Más respuestas (2)
Arash
el 11 de Oct. de 2011
0 votos
Walter Roberson
el 11 de Oct. de 2011
x = x + 3 * ~mod(x,2);
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!