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);
Answer from zenpoy on Stack Overflow
🌐
MathWorks
mathworks.com › matlab › mathematics › elementary math › constants and test matrices
NaN - Create array of all NaN values - MATLAB
For example, X = NaN(3,datatype,'gpuArray') creates a 3-by-3 GPU array of all NaN values with underlying type datatype. You can specify the underlying type datatype as one of these options: ... You can also specify the numeric variable p as a gpuArray. If you specify p as a gpuArray, the underlying ...
🌐
MathWorks
mathworks.com › parallel computing toolbox › big data processing › distributed arrays
NaN - Create codistributed array of all NaN values - MATLAB
This MATLAB function creates an n-by-n codistributed matrix of all NaN values and uses codist to specify the distribution of the array values across the workers.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › matlab tutorial › matlab nan
Matlab nan | How Nan Function Work in Matlab with examples?
March 10, 2023 - Here we take array ‘D’. A array containing the data [1 5 ; 2 6 ; 3 7 ; 4 8 ]. Now we can measure the size of the array. sz = size(D) measures the size of the array ‘D’, and the measured size is stored into the ‘sz’ variable. So as we know, that ‘NaN function’ returns a special value which containing expressions like inf/inf or 0/0. Hence we can use Matlab ‘NaN’ function for creating the 4×4 matrix of special values that cannot be a real number or complex number.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
MathWorks
mathworks.com › matlabcentral › answers › 1439334-creating-cell-with-nan
Creating cell with NaN - MATLAB Answers - MATLAB Central
August 23, 2021 - Hi, I would like to re-create a NaN array like the attached image below. Meaning, the size of the array will be 1x187, but inside the array I rather each cell be a mx1. Example 2x1, 10x1, 3x1, 13...
🌐
MathWorks
mathworks.com › matlab › programming › classes › construct and work with object arrays
createArray - Create array of specified class and value - MATLAB
This MATLAB function creates an array of objects of a given class and value, depending on the combination of input arguments passed to the function.
Find elsewhere
🌐
MathWorks
mathworks.com › matlabcentral › answers › 647178-how-to-add-nan-values-to-a-matrix
How to add NaN values to a matrix? - MATLAB Answers - MATLAB Central
November 13, 2020 - https://www.mathworks.com/matlabcentral/answers/647178-how-to-add-nan-values-to-a-matrix#comment_1133953 ... That's what my code does. I first defined the matrix A, then I increased its size by adding NaNs. It would appear you know the size of your matrices, so adapt the code I shared to increase the size of your smaller matrix so that it is the size of the larger one.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 77852-create-a-new-array-without-nan
create a new array without nan - MATLAB Answers - MATLAB Central
June 3, 2013 - I want to create two new arrays so that first array only contains those elements which have nan in them and second in which there is no nan element. ... Sign in to comment. Sign in to answer this question. ... Sign in to comment. ... Sign in to comment. Sign in to answer this question. MATLAB Language Fundamentals Data Types Data Type Conversion
🌐
Duke University
people.duke.edu › ~jmp33 › matlab › logical_nan.html
Logical Indexing, NaN, Basic Plotting
(Technically, the commands true and false create logical variables, but Matlab is usually smart enough to convert back and forth when you need it to. If you ever get in a pinch, you can use the functions logical to convert numbers to True/False logicals and double to convert from logical to numerical.) Just as importantly, we can also do operations like AND and OR: ... aa=rand(10,1); %create a 10x1 column vector of random numbers between 0 and 1 aa>0.5 bb=aa>0.5; %we can save this output cc=rand(10,1)>0.5; %cut out the middle man ee=(bb==cc) %tests equality element-wise (why isn't every entry 1?) bb|cc %short circuit OR
🌐
MathWorks
mathworks.com › matlab › mathematics › elementary math › constants and test matrices
isnan - Determine which array elements are NaN - MATLAB
TF = isnan(A) returns a logical array containing 1 (true) where the elements of A are NaN, and 0 (false) where they are not. If A contains complex numbers, isnan(A) contains 1 for elements with either real or imaginary part is NaN, and 0 for elements where both real and imaginary parts are not NaN.