# How to stop Stan processing in MATLABStan?

**URL:** <https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950>\
**Category:** Interfaces\
**Tags:** matlabstan\
**Created:** [May 23, 2019, 3:01pm UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950 "2019-05-23T15:01:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibexw](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@ibexw](https://discourse.mc-stan.org/u/ibexw)\
**Post date:** [May 23, 2019, 3:01pm UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/1 "2019-05-23T15:01:19Z")

</div>

Operating System: Windows  
Interface Version: MATLABStan  
Compiler/Toolkit:

Hi, is it possible to stop Stan within MATLAB once it has started? I understand there is a kill process in RStan but is there the same thing in MATLAB?

Thanks :)

---

<div class="post-metadata">

**Author:** ![jonah](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonah/32/200_2.png) [@jonah](https://discourse.mc-stan.org/u/jonah)\
**Post date:** [May 23, 2019, 8:10pm UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/2 "2019-05-23T20:10:10Z")

</div>

I’ve never actually used MatlabStan so I’m not sure. Anyone else know? (I think @avehtari and @brian-lau are the only two developers that are very familiar with MatlabStan)

I don’t think there’s anything special in RStan for this, we just rely on either the stop button in rstudio or cntrl c from the terminal.

How do you normally stop something in Matlab? MatlabStan just wraps CmdStan so maybe command line commands will work.

---

<div class="post-metadata">

**Author:** ![jonah](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonah/32/200_2.png) [@jonah](https://discourse.mc-stan.org/u/jonah)\
**Post date:** [May 23, 2019, 8:24pm UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/3 "2019-05-23T20:24:01Z")

</div>

And welcome to the Stan forums!

---

<div class="post-metadata">

**Author:** ![ibexw](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@ibexw](https://discourse.mc-stan.org/u/ibexw)\
**Post date:** [May 24, 2019, 7:21am UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/4 "2019-05-24T07:21:07Z")

</div>

Thanks for the welcome :). I normally stop processes in MATLAB with ctrl-c but this seems to be running in the background and I can’t see how to stop it. It may be to do with how the actual script was written that calls Stan - I’m talking to the coder later so if I find out I’ll update this thread. Thanks for taking the time to reply :)

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [May 24, 2019, 10:27am UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/5 "2019-05-24T10:27:32Z")

</div>

One way to stop the process is to kill it from Task Manager (ctrl + shift + esc). At least this works with Python.

---

<div class="post-metadata">

**Author:** ![brian-lau](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/brian-lau/32/4894_2.png) [@brian-lau](https://discourse.mc-stan.org/u/brian-lau)\
**Post date:** [May 24, 2019, 11:01am UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/6 "2019-05-24T11:01:55Z")

</div>

You can use the stop method of the StanFit object. e.g. StanFitObject.stop()

---

<div class="post-metadata">

**Author:** ![ibexw](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@ibexw](https://discourse.mc-stan.org/u/ibexw)\
**Post date:** [May 24, 2019, 11:31am UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/7 "2019-05-24T11:31:13Z")

</div>

Yes that works, thank you :)

---

<div class="post-metadata">

**Author:** ![ibexw](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@ibexw](https://discourse.mc-stan.org/u/ibexw)\
**Post date:** [May 24, 2019, 11:32am UTC](https://discourse.mc-stan.org/t/how-to-stop-stan-processing-in-matlabstan/8950/8 "2019-05-24T11:32:30Z")

</div>

Perfect - yes that works! Thankyou I thought there must be a way to do it from MATLAB :)
