MATLAB: How to add limited row to specific row

for loopif statementimage processingMATLABmatrix

Hello all I'm student I'll be glad to help me to solve below problem, that I've two matrices A is 2×9 and B is 6×3,
A= zeros(2,9)
A =
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
B=round(10*rand(6,3))
B =
7 6 9
6 7 8
4 1 7
1 1 1
8 5 1
3 5 1
by using these codes I want to add first three row of matrix B to first row of A and second three rows of matrix B to second row of matrix A by using these codes :::
for i=1:6
if i<=3
x=x(y,:)
else
end
end
I tried I don't know how inside if condition

Best Answer

A= zeros(2,9);
B = [7 6 9
6 7 8
4 1 7
1 1 1
8 5 1
3 5 1];
out = reshape(B',fliplr(size(A)))'