numRows = 50;
temperature = randi(100, [numRows, 1]);
humidity = randi(100, [numRows, 1]);
pressure = randi(100, [numRows, 1]);
precip = randi(100, [numRows, 1]);
depth = randi(100, [numRows, 1]);
temperature(10:20) = nan;
indexes = randperm(length(temperature), 8);
temperature(indexes) = nan;
T = table(temperature, humidity, pressure, precip, depth)
temperature = T.temperature
nanRows = isnan(temperature)
indexes = find(~nanRows)
repairedTemperature = [temperature(indexes(1)); temperature; temperature(indexes(end))];
nanRows = isnan(repairedTemperature)
repairedTemperature = interp1(find(~nanRows), repairedTemperature(~nanRows), 1:length(repairedTemperature))
repairedTemperature = repairedTemperature(2:end-1)';
T.temperature = repairedTemperature;
fprintf('All done with demo by Image Analyst.\n');
Best Answer