MATLAB: Gap filling with liner interpolation gap-fillinginterpolationliner interpolation Hi, I have a data file (attached) which I need to fill gaps (here in -9999) by liner interpolation. Could anyone please help me with this. Many thanks Best Answer A=xlsread('data.xlsx'); I=A==-9999; J=find(~I); B=A; B(I)=interp1(J,A(J),find(I)); Related SolutionsMATLAB: Filling in gaps incrementally Do you always have a fully populated first column as the time vector? If so, you can try the following to do the linear interpolation for younidx = data(:,2)==0;data(nidx,2) = interp1(data(~nidx,1),data(~nidx,2),data(nidx,1),'linear','extrap')HTH MATLAB: Filling gaps in binary images If it really is just one pixel, then try this:BW2 = bwmorph(BW, 'bridge');If it is more than one pixel, then take a look at IMCLOSE. This will affect the entire binary boundary in the image, however. Related QuestionFilling the gaps in a vectorMATLAB one-liners
Best Answer