It's pretty simple, but you should know that MATLAB internally saves a string in ASCII and can calculate with the corresponding numeric values.
So, first we convert each character (number) into a binary extension (length 8) and, finally, combine all these cells together with your desired result.
x = arrayfun(@(x)(dec2bin(x,8)), string, 'UniformOutput', false) x = [x{:}]
edit:. Oli Charlesworth mentions this below, the same thing can be done with the following code:
reshape(dec2bin(str, 8)', 1, [])
source share