how to convert logical variable into hexadecimal number in Matlab?

how to convert logical variable into hexadecimal number in Matlab?

2 Comments

Please provide a short example of a logical input and what you want for a hex output.
The task seems odd to me, too. hex representation of 1/0 booleans is just '1','0'.

Sign in to comment.

Answers (1)

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"

Categories

Asked:

on 17 Mar 2021

Commented:

on 18 Mar 2021

Community Treasure Hunt

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

Start Hunting!