I have a 30 x 30 matrix, called A, and I want to assign B as the leftmost 30 x 20 block of A how can I do that?
A
B
Is this the correct way to do i
A_new = A(:,1:20)
takes all the rows from A with this part A(:,) and the first 20 columns with this part A(,1:20)
A(:,)
A(,1:20)
A_newis now 30x20
A_new
You can also iterate over elements in two loops, but the above answer is easiest