Sorry if this is a repeated question but I failed to find an answer myself. I have two matrices:
A = [-0.6, -0.2; -60, 2; 6, -20]; B = [-0.4, -0.8; -40, 8; 4, -80];
I want to find all the possible combinations of sum of each row (sum of individual elements of a row) of A with each row of B, i.e., my desired result is (order does not matter):
ans = [-1, -1; -40.6, 7.8; 3.4, -80.2; -60.4, 1.2; -100, 10; -56, -78; 5.6, -20.8; -34, -12; 10, -100];
which is a matrix resulting from possible combinations of A and B.
Thanks in advance.
(Please no for loops. It is pretty trivial then.)
EDIT: I have used 2 columns and 3 rows as an example. Looking for more general solution, i.e., for n number of columns and m number of rows.
Best Answer