how to convert logical variable into hexadecimal number in Matlab?

16 visualizaciones (últimos 30 días)
samah samir
samah samir el 17 de Mzo. de 2021
Comentada: Adam Danz el 18 de Mzo. de 2021
how to convert logical variable into hexadecimal number in Matlab?
  2 comentarios
James Tursa
James Tursa el 17 de Mzo. de 2021
Please provide a short example of a logical input and what you want for a hex output.
Adam Danz
Adam Danz el 18 de Mzo. de 2021
The task seems odd to me, too. hex representation of 1/0 booleans is just '1','0'.

Iniciar sesión para comentar.

Respuestas (1)

Adam Danz
Adam Danz el 17 de Mzo. de 2021
Editada: Adam Danz el 17 de Mzo. de 2021
hexstr = dec2hex([false true true false])
hexstr = 4×1 char array
'0' '1' '1' '0'
Or perhaps you want,
hexstr = string(double(([false true true false])))
hexstr = 1×4 string array
"0" "1" "1" "0"

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by