MATLAB: Replacing a portion of matrix in cell with value of another matrix

cell array

Hi, I have some problems in creating:
A cell eg : A = {[100x70double], [50×120], [7×20]} However, I want to replace the value of a portion from each array of cell A from another array. The replacement size is [2×3] where the value is B= [1.1 1.2 1.3;2.1 2.2 2.3;]
I'm currently trying this:
% code
for i = 1:size(A,1)
for j = 1:size(A,2)
A {i,j} (1:4,1:7) = B
end
end
But i've got "Subscripted assignment dimension mismatch" error.
Thank you in advance.

Best Answer

It should be:
for i = 1:size(A,1)
for j = 1:size(A,2)
A {i,j} (1:2,1:3) = B;
end
end
The indices which you specify shall cover 2X3. 1:4,1:7 makes a 4x7 matrix.