Change Float or Double to Integer Data type

924 visualizaciones (últimos 30 días)
Gabriel Enzo
Gabriel Enzo el 27 de Jun. de 2022
Comentada: Walter Roberson el 27 de Jun. de 2022
Hello everyone, i was have a project to process to change data float or integer to integer, because i have real time data with float and double data, and i want to change to integer data?, thank you
  3 comentarios
Gabriel Enzo
Gabriel Enzo el 27 de Jun. de 2022
oke thank for your information
Walter Roberson
Walter Roberson el 27 de Jun. de 2022
If you have real-time data: are you using Simulink to target a DSP or to target VHDL or FPGA ? If you are targetting embedded systems, then sometimes the way to go for real-time data is to use the Fixed Point Toolbox.

Iniciar sesión para comentar.

Respuesta aceptada

Lokesh
Lokesh el 27 de Jun. de 2022
Editada: Lokesh el 27 de Jun. de 2022
Float and double data can be changed to integer using int32 and int64 depending on how large the float/double number is.
Ex: If X is the number to be converted, then X can be converted to integer in this way :
X = int32(X) or X= int64(X)
(X is converted to integer and then the converted integer is stored back in X)

Más respuestas (0)

Categorías

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

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by