When numerical data type changes while assigning new data?
Mostrar comentarios más antiguos
I just came across something concerning data types which I find astonishing.
i1 = int8( 10 ); class( i1 )
i1 = 10.1; class( i1 )
i1 is int8 after the first line, but changes to double in the 2nd line
im1 = int8( [1 2 3]); class(im1)
im1(1) = 1.1; class(im1)
im1 is int8 after 1st line and remains int8 in the 2nd line, i.e. the floating point value is casted to int8
Why is the behaviour different depending on the matrix size? Is this explained somewhere in the documentation?
I use R2015b.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!