I have a 5x5 matrix M = magic(5)and I must add two sub-matrices of it (using thesumcommand) and store it inG`, they are:
M(1:3,1:3) and M(3:5,3:5)
And I wrote this, but I', not sure if it's correct,
G=sum(M([1:3,1:3],[3:5,3:5]));
I have a 5x5 matrix M = magic(5)and I must add two sub-matrices of it (using thesumcommand) and store it inG`, they are:
M(1:3,1:3) and M(3:5,3:5)
And I wrote this, but I', not sure if it's correct,
G=sum(M([1:3,1:3],[3:5,3:5]));
Copyright © 2021 Jogjafile Inc.
As mentioned in comments, you could easily accomplish your goal with
+.It could get a little complicated if you want to use
sum,