# Trying to use named tuple parameter list with callback in DifferentialEquations

**URL:** <https://discourse.julialang.org/t/trying-to-use-named-tuple-parameter-list-with-callback-in-differentialequations/23246>\
**Category:** New to Julia\
**Created:** [April 17, 2019, 3:47pm UTC](https://discourse.julialang.org/t/trying-to-use-named-tuple-parameter-list-with-callback-in-differentialequations/23246 "2019-04-17T15:47:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [April 17, 2019, 3:47pm UTC](https://discourse.julialang.org/t/trying-to-use-named-tuple-parameter-list-with-callback-in-differentialequations/23246/1 "2019-04-17T15:47:11Z")

</div>

I’m doing some work with ODEs using DifferentialEquations.jl (really fantastic tool, BTW!) and I would like to have named fields for my parameters so that when I change them in affect functions I can use integrator.p.somethingmeaningful rather than integrator.p[4]. However, named tuples don’t work (or rather they work until I hit a condition) because the affect function can’t change them. I tried a mutable struct but then I got an iteration error on said struct.

Is there a recommended way to do this or can someone point me to an example?

If one of those approaches should work I’ll try to make a simpler example so I can post the code without asking folks to wade through too much irrelevant stuff.

Thanks!

---

<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:** [April 17, 2019, 4:32pm UTC](https://discourse.julialang.org/t/trying-to-use-named-tuple-parameter-list-with-callback-in-differentialequations/23246/2 "2019-04-17T16:32:53Z")

</div>

[https://github.com/JuliaDiffEq/LabelledArrays.jl](https://github.com/JuliaDiffEq/LabelledArrays.jl) gives you something like a mutable named tuple.

---

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [April 17, 2019, 5:52pm UTC](https://discourse.julialang.org/t/trying-to-use-named-tuple-parameter-list-with-callback-in-differentialequations/23246/3 "2019-04-17T17:52:29Z")

</div>

LVector is exactly what I was looking for - my affect functions are much more readable now (and won’t all break if I add or delete some parameters from my model).

Thanks.
