MATLAB: Interpolating within time series

bsxfuninterp1

I need to replace NaNs in a long time series that has consecutive (varying lengths) and non-consecutive NaNs. I tried the solution in this link https://au.mathworks.com/matlabcentral/answers/160575-replacing-nan-values-with-average-values-of-the-nearest-numbers but it doesn't seem to work for all my NaNs (not familiar with the bsxfun @(x,y)). Thanks for your help,
1438.60000000000
1446.53000000000
NaN
1426.85000000000
1414.34000000000
1419.98000000000
1418.46000000000
1420.29000000000
1426.09000000000
1422.12000000000
NaN
NaN
1464.23000000000
1459.20000000000
1463.32000000000
1474.46000000000
1460.27000000000
1441.50000000000
1442.72000000000
1446.23000000000
1443.48000000000
1444.55000000000
1443.79000000000
1444.55000000000
NaN
NaN
NaN
1484.07000000000
1482.54000000000

Best Answer

>> idx = ~isnan(A);
>> interp1(find(idx),A(idx),(1:numel(A))')
ans =
1438.6
1446.5
1436.7
1426.8
1414.3
1420
1418.5
1420.3
1426.1
1422.1
1436.2
1450.2
1464.2
1459.2
1463.3
1474.5
1460.3
1441.5
1442.7
1446.2
1443.5
1444.6
1443.8
1444.6
1454.4
1464.3
1474.2
1484.1
1482.5