You will be provided with an array or matrix that contains various numbers, in addition to an evening variable, e, set to 1 or 0. If e==1, then you should return an evened version of the matrix, wherein all odd numbers have one added to them to make them even. For example,
- if M = 1:10,
- then the evened array is [2,2,4,4,6,6,8,8,10,10].
On the other hand, if e==0, then you should return the same matrix with only odd numbers, wherein one has been added to every even number. For example,
- if M = 1:10,
- then the odd array is [1,3,3,5,5,7,7,9,9,11].
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers174
Suggested Problems
-
Sum all integers from 1 to 2^n
17470 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3676 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
647 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
884 Solvers
-
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
2041 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!