how to convert logical variable into hexadecimal number in Matlab?

16 vues (au cours des 30 derniers jours)
samah samir
samah samir le 17 Mar 2021
Commenté : Adam Danz le 18 Mar 2021
how to convert logical variable into hexadecimal number in Matlab?
  2 commentaires
James Tursa
James Tursa le 17 Mar 2021
Please provide a short example of a logical input and what you want for a hex output.
Adam Danz
Adam Danz le 18 Mar 2021
The task seems odd to me, too. hex representation of 1/0 booleans is just '1','0'.

Connectez-vous pour commenter.

Réponses (1)

Adam Danz
Adam Danz le 17 Mar 2021
Modifié(e) : Adam Danz le 17 Mar 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"

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by