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

Problem 690. Remove the two elements next to NaN value

Created by Aurelien Queffurust

The aim is to remove the two elements next to NaN values inside a vector.

For example:

 x = [6 10 5 8 9 NaN 23 9 7 3 21 43 NaN 4 6 7 8]

The output y will be:

 y = [6 10 5 8 9 7 3 21 43 7 8]

Nan values and the 2 next elements after the NaN (23-9 and 4-6) have been removed.

There will be always NaN values in the input vector followed by at least 2 integers.

Problem Group

Solution Statistics

80 correct solutions 63 incorrect solutions
Last solution submitted on Oct 13, 2014

Problem Comments