MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Andrew Buglass
on 5 Feb 2013

Hello,

I have a series of "radials" around a pier giving the depth of a bed and I wish to plot. However, before doing so would like to interpolate the 0 values in between the radials. Any suggestions how to accomplish would be much appreciated?

if true 23 0 0 34 0 0 26 0 0 29 0 22 0 21 0 0 24 0 31 0 0 0 20 22 0 0 22 23 0 0 0 0 0 -400 -400 -400 -400 0 0 0 24 26 25 -400 -400 -400 -400 24 25 29 0 0 0 -400 -400 -400 -400 0 0 0 0 0 25 28 0 0 31 26 0 0 0 26 0 29 0 0 24 0 27 0 27 0 0 30 0 0 27 0 0 29 end

This is small piece of one set of data there are much more zero values on the original and there are 16 different sets of data. So manually calculated is not viable.

Thanks in Advance.

Andy

*No products are associated with this question.*

Answer by Jan Simon
on 5 Feb 2013

Edited by Jan Simon
on 5 Feb 2013

You can set the 0 values to NaN:

x(x==0) = NaN;

and call FEX: inpaint_nans.

Perhaps this helps also: FEX: gridfit

Andrew Buglass
on 5 Feb 2013

I've had a go at using the inpaint_nans file but cannot get it to work. Any chance of a bit of guidance please.

Jan Simon
on 5 Feb 2013

A guidance is more likely, when you explain "cannot get it to work" with any details.

## 0 Comments