title: Subtraction two vectors in Matlab
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/13422606/matlab-matrix-of-differences">MATLAB: Matrix of differences</a>  </p>
  </blockquote>
  
  
  
  <p>I am not sure how to word this question but I will do my best:</p>
  
  <p>I have two vectors, <code>A</code> and <code>B</code>.</p>
  
  <p>I want to subtract the all values in <code>A</code> by every individual value of <code>B</code>.</p>
  
  <p>For example, all values in <code>A</code> are subtracted by the first value of <code>B</code>. Then the all values of <code>A</code> are subtracted by the second value of B, and so on.</p>
  
  <p>The resultant matrix should be <code>length(A) x length(B)</code> and look something like this:</p>
  
  <p><code>Ans = [A - B(1); A - B(2); A - B(3); ....... ]</code></p>
  
  <p>Is there any way of doing this without a loop?</p>