# Initialize array without zeros

I have a 3-D array representing the xy grid and the z vector is the depth. I only know the depths of certain strings and am trying to interpolate the array. My questions are how to create a 720x400 array without setting all values ββto 0 (as this might affect interpolation).

Thank!

source to share

There is no need to initialize empty strings with a special value. Instead, you can modify the interpolation routine to assign zero weight to these strings. Then they will not affect interpolation.

An easy way to do this in MATLAB would be to use the griddata method for interpolation.

source to share

You can use:

```
A = nan(m,n,...);
```

to initialize the matrix with `NaN's`

if that's what you are asking for. Another popular choice is `inf(m,n,...)`

for initialization with `Inf's`

and `ones(m,n,...)`

for initialization with `1's`

.

So, to create a 720x400 matrix complete `NaN's`

, you can simply:

```
A = nan(720,400);
```

source to share