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

8 Solutions

5 Solvers

Last Solution submitted on Jun 15, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers5

Suggested Problems

More from this Author30

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!