title: Adding columns to a matrix in loop
body: <p>I am trying to add selective columns from one matrix to another matrix in loop when condition becomes true. I have tried various combinations but it adds in rows with np.append etc commands, Any help is appreciated. Thanks</p>
  
  <p>I have tried np.append, np.concatenation, np.hstack commands but not getting the desired soltuion.</p>
  
  <pre><code>n,m=np.shape(K)
  Z=np.array([])
  for number in range(m):
      A=function
      if A&lt;0.05:
          Z = np.append(Z,np.vstack(K[:,number]))
  </code></pre>
  
  <p>I want Z matrix with columns of K that satisfy the condition A. Like 
  Z=[K[:,3] K[:,8] K[:,10]]</p>