How to fill matrix with NaN in Octave
Also see: How to initialize NaN matrix in octave
If you have a matrix in Octave like
A = zeros(2,4)
you can fill it with NaN
using
A(:,:) = NaN
Note that you have to use A(:) = NaN
for 1D-matrices. A(:,:) = NaN
for 2D matrices, A(:,:,:) = NaN
for 3D matrices and so on.
Example:
>> A = zeros(2,4)
A =
0 0 0 0
0 0 0 0
>> A(:,:) = NaN
A =
NaN NaN NaN NaN
NaN NaN NaN NaN