title: Matching values from a matrix to an array
body: <p>I have a matrix of binary values with the size 211 x 129 e.g.:</p>
  
  <pre><code>matrix =
  
  (
  
     0   0   1   1   0   0   0   0   0 ...   0   1   1   0   0   0   0   
     0   0   1   1   0   1   1   0   0 ...   0   0   0   0   0   0   0   
     0   0   0   0   0   0   0   0   0 ...   0   0   0   0   0   0   0   
     0   0   0   0   0   0   0   0   1 ...   0   0   0   0   0   0   0 
     ...
     ...
     ...  
  
  )
  </code></pre>
  
  <p>and I have an array of 211 numbers:</p>
  
  <pre><code>   array =
  
   [
  
     [158 147  35 162 143 139   8 129  43  97 163 151  24 103 161  54  38  10
      100 193 192 191 188 187 186 185 184 182 181 179 178 177 176 175 174 171
      170 169 167 166 155 154 152 149 148 146 145 142 141 136 134 132 130 
     ....
  
   ]
  </code></pre>
  
  <p>I would like to match the numbers to the corresponding row in the array and create a new matrix. Very important is that the number from the array e.g. 158 gets exactly row 158 of the matrix.</p>
  
  <p>The output would look like this:</p>
  
  <pre><code>   new_matrix:
  
   (
  
     158 0   0   0   1   0   0   0   0   0 ...   0   0   1   0   0   0   0 //Values of row 158 from the matrix     
     147 0   0   1   0   0   1   1   0   0 ...   0   0   0   0   0   0   0 //Values of row 147 from the matrix     
     35  0   0   1   1   0   0   0   0   0 ...   0   0   0   0   0   0   0    //Values of row 35 from the matrix   
     162 0   0   0   0   0   0   0   0   1 ...   0   0   0   0   0   1   1 
  
     143 
     ...
     ...
  
   )
  </code></pre>
  
  <p>Any guidance?</p>