Delete the rows in the middle - MATLAB Cody - MATLAB Central

Problem 2172. Delete the rows in the middle

Difficulty:Rate

We will delete the rows in the middle and keep the first and the last rows.

For example if input is

 [1 2
  1 7
  1 8
  1 6
  1 5]

then output will be

 [1 2
  1 5]

keeping the first and the last rows. However there will be more than one row index and that makes this question challenging.

Note: Elements of input row index is always greater than or equal to 2.

Related Challenge - Problem 2084. Sum Rows

Solution Stats

30.6% Correct | 69.4% Incorrect
Last Solution submitted on Jun 19, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers32

Suggested Problems

More from this Author92

Problem Tags

Community Treasure Hunt

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

Start Hunting!