Problem 2172. Delete the rows in the middle

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

42.19% Correct | 57.81% Incorrect
Last solution submitted on Apr 15, 2017

Problem Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!