MATLAB: How to define 4 bit Enumerated value and a nibble(4 bits) in Matlab

data type

Hello,
how to define 4 bit Enumerated value and a nibble(4 bits) in Matlab

Best Answer

Use a number between 0 and 15.
n = 8;
To convert to binary
nbin = dec2bin(n) - '0';
dec2bin return a string, the -'0' converts this string to an array of 0's and 1's.