MATLAB: How to convert hex number ‘0’ to binary when it is at first place in a bit stream

hex 0

hex_str='0123';
actual answer is 0000000100100011 but matlab is not showing the starting zeros as it giving the answer 10010011

Best Answer

s='0123'
b=strjoin(cellfun(@(x) dec2bin(hex2dec(x),4),regexp(s,'.','match'),'un',0),'')