Hey guys, I have two Matrices with the same number of columns but different number of rows, and I wish to insert Matrix A into Matrix B so in this example:
A = rand(25,50);B = zeros(50,50);[M N] = size(A);
I then want to insert A into B, but I want to be able to define where I set them. So in this case:
X = 10;Y = 35;
As they have the same number of columns I attempted to simply insert a couple of ways:
B(X:Y,1:end) = A; % This gives a "Subscripted assignment dimension mismatch"
B(X:Y, 1:N) = A; % Same error as above
B(X:Y,1:end) = A(1:M,1:end); % again same error
The output of this would be a (50,50) Matrix (B), with rows X:Y of B being replaced Matrix A.
Maybe a for loop would work here? I'm not entirely sure where to proceed from this point. Any help would be greatly appreciated.
Best Answer