MATLAB: Matrix dimensions must agree.

Image Processing Toolboxmatrix

I keep getting the error message : Matrix dimensions must agree. from the code "A = abs(imgA).*exp(1*(1i*rando*pi)); " May i know what is the solution for this?
%% Mesh
close all
n=145; % Number of pixels on one axis
rmax=1; % Normalized radius
X=2*rmax*(-n/2+0.5:1:n/2-0.5)/n; % range for grid (from R=0 to R=1)
Y=2*rmax*(-n/2+0.5:1:n/2-0.5)/n; % range for grid (from R=0 to R=1)
[xm,ym]=meshgrid(X,Y); % x-y coordinates for range of grid
R= sqrt(xm.^2 + ym.^2); % Normalized radius vector
rando=randn(145,145); % random phase initialization
imgA = imread('void.jpg');
imgB = imread('void2.jpg');
%Convert source image to Grayscale
imgA = rgb2gray(imgA);
imgB = rgb2gray(imgB);
figure; imshow(imgA); title('Grayscale ImageA');
figure; imshow(imgB); title('Grayscale ImageB');
%Get the size of the source image
[rowsSource, colsSource, numberOfColorChannelsSource] = size(imgA);
%Get the size of image B
[rowsTarget, colsTarget, numberOfColorChannelsTarget] = size(imgB);
%Check if lateral sizes match
if rowsimgB ~= rowsimgA || colsimgA ~= colsimgB
imgB = imresize(imgB, [rowsimgA colsimgA]);
end
%Convert images to double
imgA = im2double(imgA);
imgB = im2double(imgB);
%% Source plane to target plane
A = abs(imgA).*exp(1*(1i*rando*pi)); % source amplitude (captured on camera) with random source phase = reconstructed source mode
A=A./max(max(A));

Best Answer

rando = randn(size(imgA)); % random phase initialization, put this line after imgA = ...
size(imgA) should be be equal to size(rando) to be compatible with matrix or array vs matrix multiplication