MATLAB: How to convert a string to a 8 bit Ascii one row binary vector

binary

Hello everyone. I have for example the string:"abcd" i want to convert it to "01100001011000100110001101100100" (see the apendded zeros). as a logical vector.
thanks!

Best Answer

s='abcd'
p=dec2bin(double('abcd'),8)'
out=p(:)'