Lets say I have matrix
a = [ 1 1 1 1;
1 1 1 1;
1 1 1 1]
And I would like to multiply the sub-matrix a(2:3, 2:3)
by 5;
So that the new matrix is
a = [ 1 1 1 1;
1 5 5 1;
1 5 5 1]
What function does that ? I've tried this = >
a = a(2:3, 2:3)*5;
But that would just give me a new matrix 2x2
a = [5 5;
5 5]
You need to specify the target correctly.
A=ones(6,6);
A(3:4,3:4) = A(3:4,3:4)*5
A =
1 1 1 1 1 1
1 1 1 1 1 1
1 1 5 5 1 1
1 1 5 5 1 1
1 1 1 1 1 1
1 1 1 1 1 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With