Find all elements less than 0 or greater than 10 and replace them with NaN - MATLAB Cody - MATLAB Central

Problem 17. Find all elements less than 0 or greater than 10 and replace them with NaN

Difficulty:Rate

Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN.

Example:

 Input  x =  [  5  17 -20  99  3.4  2  8  -6 ]
 Output y is [  5 NaN NaN NaN  3.4  2  8 NaN ]

Solution Stats

42.38% Correct | 57.62% Incorrect
Last Solution submitted on Nov 04, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...

Problem Recent Solvers15691

Suggested Problems

More from this Author96

Community Treasure Hunt

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

Start Hunting!