MATLAB: How to solve the problem of matrices dimension must agree

matrix manipulation

Hello, i need an assistance on how to add two variables/matrices in my code below. one is w_LL(256x256x3 double) and the other is Ir_LL(256×256 double).Attached is the code.Thank you.
CODE——————
t=0.10;
newhost_LLr =Ir_LL+(t*w_LL);
r2=idwt2(newhost_LLr,Ir_LH,Ir_HL,Ir_HH,'haar');
figure(2);imshow(uint8(r2));title('Watermarked image of r component');
newhost_LLg =Ig_LL+(t*w_LL);
g2=idwt2(newhost_LLg,Ig_LH,Ig_HL,Ig_HH,'haar');
figure(2);imshow(uint8(g2));title('Watermarked image of g component');
newhost_LLb =Ib_LL+(t*w_LL);
b2=idwt2(newhost_LLb,Ib_LH,Ib_HL,Ib_HH,'haar');
figure(2);imshow(uint8(r2));title('Watermarked image of g component');
%imwrite(uint8(rgb2),'images/Watermarked33.jpg');

Best Answer

Make it an RGB image also
rgbImage = cat(3, Ir_LL, Ir_LL, Ir_LL);
newhost_LLr = rgbImage + (t * w_LL);