MATLAB: Is there no warning when trying to assign NaNs to a INT32 type array in MATLAB

MATLABolddocs

When attempting to assign NaN values to an INT32 datatype, MATLAB does not throw a warning. For example,
a=int32([0 0 1 1])
a(1:2)=NaN

Best Answer

NaN values can only be assigned to single or double data types. Assigning a NaN to an int32 value should throw a warning. By default this warning is turned off. To turn on this warning,please execute the following command in MATLAB:
warning on MATLAB:intConvertNaN
Now,when you try to assign NaN values to a Int32 array, you will receive a warning.