Possible Duplicate:
MATLAB: Matrix of differences
I am not sure how to word this question but I will do my best:
I have two vectors, A and B.
I want to subtract the all values in A by every individual value of B.
For example, all values in A are subtracted by the first value of B. Then the all values of A are subtracted by the second value of B, and so on.
The resultant matrix should be length(A) x length(B) and look something like this:
Ans = [A - B(1); A - B(2); A - B(3); ....... ]
Is there any way of doing this without a loop?