How can I add a vector to a matrix in Matlab, in a manner that the i’s index of the vector would be added to all the members in the i’s row?
for example:
A = [1 2 3;
4 5 6;
6 7 8]
v = [1;
2;
3]
the required result is:
[2 3 4;
6 7 8;
9 10 11]
Thanks a lot.
An alternative to
bsxfunis to userepmatand repeat the column vectorvas many times asAhas columns: