If you want to transmit and recieve an image in MATLAB, when you need a vector of 1XN but you have an array of P1XP2XZ you can use the following code:
%Transmitter
in=imread('untitled.jpg');
N=numel(in);
in2=reshape(in,N,1);
bin=de2bi(in2,'left-msb');
input=reshape(bin',numel(bin),1);
%Receiver
b1=reshape(input,8,N)';
dec_qpsk=bi2de(b1,'left-msb');
im_qpsk=reshape(dec_qpsk(1:N),size(in,1),size(in,2),size(in,3));
imshow(im_qpsk);