I have this so far:
data = 14
out = dec2bin(data, 4)
which gives:
out = 1110
But I want to get binary num
You're looking for de2bi with the 'left-msb' option.
data = 14
out = de2bi(data, 4,'left-msb')
Which requires the Communication Systems Toolbox though. Alternatively use your original approach with the fundamental dec2bin with the following addition:
data = 14
out = double( dec2bin(data, 4) ) - 48
out =
1 1 1 0