Why is there no warning when trying to assign NaNs to a INT32 type array in MATLAB?

4 visualizaciones (últimos 30 días)
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

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Jun. de 2009
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.
  3 comentarios
Steven Lord
Steven Lord el 5 de Abr. de 2020
The four integer warnings were removed in release R2010a, as indicated by this entry in the Release Notes.
Les Beckham
Les Beckham el 13 de Abr. de 2020
Thanks for the info, Steven. That's disappointing, though. I really don't agree with Matlab doing something other than what it is told without any warning.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by