# Using results from ODEProblem while it is running

**URL:** <https://discourse.julialang.org/t/using-results-from-odeproblem-while-it-is-running/8874>\
**Category:** Modelling & Simulations\
**Tags:** question, diffeq\
**Created:** [February 6, 2018, 10:09pm UTC](https://discourse.julialang.org/t/using-results-from-odeproblem-while-it-is-running/8874 "2018-02-06T22:09:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindbound](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindbound/32/587_2.png) [@mindbound](https://discourse.julialang.org/u/mindbound)\
**Post date:** [February 6, 2018, 10:09pm UTC](https://discourse.julialang.org/t/using-results-from-odeproblem-while-it-is-running/8874/1 "2018-02-06T22:09:16Z")

</div>

Hello all,

I’m currently studying the documentation of [DifferentialEquations.jl](https://github.com/JuliaDiffEq/DifferentialEquations.jl) and trying to port my older computational neuroscience codes for using it instead of my own, less elegant and performant, ODE solvers. While doing this, I stumbled upon the following question: is it possible to access and use the results returned from the solver as soon as the current step is returned (instead of waiting for the problem to finish)?

I’m looking for a way to e.g. plot in real-time the voltage levels of a simulated neuron, which seems like a simple enough task and one that’s probably trivial to do using already existing Julia packages but I can’t figure out how. Does it have to do anything with callbacks? Thanks in advance.

Cross-posted in [julia - Using results from ODEProblem while it is running - Stack Overflow](https://stackoverflow.com/questions/48652964/using-results-from-odeproblem-while-it-is-running)

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 7, 2018, 1:44am UTC](https://discourse.julialang.org/t/using-results-from-odeproblem-while-it-is-running/8874/2 "2018-02-07T01:44:28Z")

</div>

[Answered on StackOverflow](https://stackoverflow.com/a/48654717/1544203). Basically, the way to solve this is to use the [integrator interface](http://docs.juliadiffeq.org/latest/basics/integrator.html) which allows you to control the building of the solution step-by-step, and this has an iterator interface that can be exploited to make it easier.

---

<div class="post-metadata">

**Author:** ![mindbound](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mindbound/32/587_2.png) [@mindbound](https://discourse.julialang.org/u/mindbound)\
**Post date:** [February 7, 2018, 1:55am UTC](https://discourse.julialang.org/t/using-results-from-odeproblem-while-it-is-running/8874/3 "2018-02-07T01:55:39Z")

</div>

Fantastic, thank you. This is exactly what I was looking for.
