title: Convert a numpy array to iterator
body: <p>I want to use an array as argument of a function which will be used to solve an ODE function.</p>
  
  <pre><code>def ode(x, t, read_tau, tau_arr):
    q_ib = x[0:4]
    omega = x[4:7]
  
    dq_ib = 0.5 * np.dot(gen_omega(omega), q_ib) + read_tau(tau_arr)
  
    return dq_ib
  
  dq_ib = odeint(rhs, x0, t, args=(b_I, read_tau, tau_arr))
  </code></pre>
  
  <p>And tau_arr is an (1000, 3) array. The only solution I can think of is first make tau_arr as an iterator and in read_tau().  </p>
  
  <pre><code>def read_tau(tau_arr):
    return next(tau_arr)
  </code></pre>
  
  <p>And the return value of read_tau function will be a 1x3 array which will be used to solved ODE.</p>
  
  <p>My question is how to convert a 2-dimensional array into an iterator, and when calling the iterator with next(), it will return an array row by row.  </p>
  
  <pre><code>a = np.array([[1,2,3], [4,5,6]])
  convert_to_iter(a)
  next(a)
  [1,2,3]
  next[a]
  [4,5,6]
  </code></pre>