Write a function called
outMat = odd_idx( myMat )
that takes a matrix, myMat, as input argument and returns a matrix that contains only those elements of myMat that are in odd rows and columns. In other words, it would return the elements of myMat at indices (1,1), (1,3), (1,5), …, (3,1), (3,3), (3,5), …, etc. Note that both the row and the column of an element must be odd to be included in the output. The following would not be returned: (1,2), (2,1), (2,2) because either the row or the column or both are even. As an example, if myMat were a 5-by-8 matrix, then the output must be 3-by-4 because the function omits rows 2 and 4 of myMat and it also omits columns 2, 4, 6, and 8 of myMat.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers54
Suggested Problems
-
Remove the polynomials that have positive real elements of their roots.
1743 Solvers
-
Is my wife right? Now with even more wrong husband
1346 Solvers
-
Count decimal digits of a number
236 Solvers
-
find the surface area of a cube
568 Solvers
-
Create sequnce 1 4 9 16 25.........
417 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!