Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Initialize array without zeroes

I have an 3 dimensional array that represents an xy grid, and the z vector represents depth. I only know depths of certain rows and am trying to interpolate the array. My questions is how do I create a 720x400 array, without setting all the values to 0 (as that could affect the interpolation).

Thanks!

like image 394
gberg927 Avatar asked Feb 15 '26 16:02

gberg927


1 Answers

You can use:

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

to initialize a matrix with NaN's, if that is what you ask for. Other popular choices are inf(m,n,...) to initialize with Inf's and ones(m,n,...) to initialize with 1's.

So, to create a 720x400 matrix full of NaN's you can just:

A = nan(720,400);
like image 179
zenpoy Avatar answered Feb 18 '26 14:02

zenpoy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!