MATLAB: Binary Image is all white instead of Black and White

all whitebwImage Processing Toolbox

I converted an image to binary, sent it over to a server, received it and now I am trying to display the image. The image I am able to get is all white and not black and white. I pasted the binary array and the code I'm using.
binaryImage = logical(reshape(myString, 150, []));
imshow(binaryImage, []);

Best Answer

That is to be expected. '0' and '1' have numeric equivalents 48 and 49 not 0 and 1. You need to subtract '0' (48) from the input string.