MATLAB: How to convert demodulated binary bits into image

binary to image

inverse of
x=reshape((dec2bin(typecast(a(:),'uint8'),8)-'0').',1,[]);

Best Answer

s=num2cell(reshape(x,8,[])',2)
b=cellfun(@(x) bin2dec(strrep(num2str(x),' ','')),s);
out=reshape(b,n,m); % your original image is nxm