and the vector is [1 2 3]' the result should then be
0 1 2
2 3 4
4 5 6
Try:
a=[1 2 3;4 5 6; 7 8 9]
b=[1 2 3]'
a-repmat(b,1,3)
see help repmat for more info.
/PB
Is anyone else getting the impression that someone gave this as a homework
excercise?
Yes, it struck my mind, right after my posting of a solution.
/PB
Thank you all for the concearns but this isn't homework =)