Problem 71. Read a column of numbers and interpolate missing data

Created by Cody Team in Community

Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be indicated by the number 9999. If you encounter missing data, you should perform linear interpolation to the nearest accurate data points (missing data will not occur in the first or last element).

The first row is always descriptive text. So if the input cell array s is

 s = { ...
    'Day  Temp'
    '  1   -5'
    '  2   19'
    '  3   1'
    '  4   9999'
    '  5   3'};

then the output variable t is the following row vector.

 t = [-5 19 1 2 3];

Here's an example of real-world data.

Solution Stats

35.48% Correct | 64.52% Incorrect
Last solution submitted on Mar 22, 2019

Problem Comments

Solution Comments

Recent Solvers520

Suggested Problems

More from this Author95

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!