MATLAB: Binary String to ASCII

asciibinary

If I have a character array of binary numbers, representing the ASCII code of a text string, how do I convert those numbers back to the text representation? The character array is 35×1, which should result in 5 ascii characters. I tried:
ascii_msg_decoded=char(bin2dec(reshape(bin_msg,[],7)));
It does convert to ASCII, but the characters are not correct.

Best Answer

How did you do it? This seems to work.
M = 'Hello';
% Now encode:
Mbinlong = reshape(dec2bin(double(M),7).',[],1)
% Now decode:
mess = char(bin2dec(reshape(Mbinlong,7,[]).').')