# User-provided function in run\_regularly

**URL:** <https://brian.discourse.group/t/user-provided-function-in-run-regularly/741>\
**Category:** Support\
**Tags:** cpp\_standalone, user-function\
**Created:** [15 July 2022 21:39 UTC](https://brian.discourse.group/t/user-provided-function-in-run-regularly/741 "2022-07-15T21:39:50Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![DavidKing2020](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@DavidKing2020](https://brian.discourse.group/u/DavidKing2020)\
**Post date:** [19 July 2022 15:38 UTC](https://brian.discourse.group/t/user-provided-function-in-run-regularly/741/7 "2022-07-19T15:38:44Z")

</div>

Hi Marcel

I’m trying to implement the suggestion you made in the following thread:

[Re-run the model in a previous time segment during a long run](https://brian.discourse.group/t/re-run-the-model-in-a-previous-time-segment-during-a-long-run/296)

```
 Quote: " If you want to do it in C++ standalone mode, then the only way I can think of is via C++ code that 
  implements the logic. Instead of `rate = ta_img(t, i)*Hz` you’d use something like `rate = my_func(t, 
  i)*Hz` and implement `my_func` in C++ so that it looks at the recent firing rate and decides whether 
  to present the next stimulus or the same stimulus with a higher firing rate."

```

In that thread you pointed to the same thread of discussion with @mdepitta. I can try to digest further by going through the discussion but it would be very helpful if could provide inputs to my specific issues.

---

_[View the full topic](https://brian.discourse.group/t/user-provided-function-in-run-regularly/741)._
