Given an array or a matrix, extract all elements that satisfy a specified parity condition ('even' or 'odd') and return them as a single flattened vector.
Task: Write a function extract_parity(data, type) where type is either 'even' or 'odd'. Return a vector containing only the numbers matching that type.
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
-
MATLAB 101: Extracting Even/Odd Values
4 Solvers
More from this Author18
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!