Input v is a vector. Return all the elements of v which are not a local minimum or maximum.

Example:

 v = [1 2 3 4 5]
 Output = [1 2 3 4 5]
 v = [1 2 3 2 1]
 Output = [1 2 2 1]
 v = [1 2 1 0 2 1]
 Output = [1 1 1]

Solution Stats

222 Solutions

96 Solvers

Last Solution submitted on Dec 26, 2025

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers96

Suggested Problems

More from this Author44

Problem Tags

Community Treasure Hunt

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

Start Hunting!