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

6 Solutions

4 Solvers

Last Solution submitted on Jun 14, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers4

Suggested Problems

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!