title: Subtracting rows and columns from a vector at non-zero indices MATLAB
body: <p>Suppose I have the following matrix in MATLAB:</p>
  
  <pre><code>A =[0    0    4    0; 
      0    5    0    3; 
      1    2    0    0];
  </code></pre>
  
  <p>given the following vectors: </p>
  
  <pre><code>b1 = [1 2 3];
  b2 = [2 3 4 5];
  </code></pre>
  
  <p>the output should look like this:</p>
  
  <pre><code>C1 =[0    0    3    0; 
       0    3    0    1; 
      -2   -1    0    0];
  
  C2 =[0    0    0    0; 
       0    2    0   -2; 
      -2   -1    0    0];
  </code></pre>
  
  <p>C1 and C2 are column-wise and row-wise subtraction of the original matrix A from vectors happening at <strong>non-zero elements</strong>. Note A in reality is <strong>sparse matrix</strong>. Obviously answers without using loop is appreciated! Thank you</p>