# Connect matlab with ampl

**URL:** <https://discuss.ampl.com/t/connect-matlab-with-ampl/617>\
**Category:** Support\
**Tags:** general, errors-and-messages\
**Created:** [June 22, 2023, 2:26pm UTC](https://discuss.ampl.com/t/connect-matlab-with-ampl/617 "2023-06-22T14:26:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tania\_Castellanos](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/tania_castellanos/32/333_2.png) [@Tania\_Castellanos](https://discuss.ampl.com/u/Tania_Castellanos)\
**Post date:** [June 22, 2023, 2:26pm UTC](https://discuss.ampl.com/t/connect-matlab-with-ampl/617/1 "2023-06-22T14:26:19Z")

</div>

Hi, I’m having a problem trying to use AMPL from Matlab.  
I am using the following line of code:  
ampl = AMPL(‘“C:\amplbundle.mswin64\ampl.mswin64\amplide\amplide.exe”’);  
To connect the Matlab API with AMPL, this line manages to open AMPL, but it never exits this command, Matlab keeps executing it and does not continue with the code.

Has anyone else had this problem.  
thank you

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [June 22, 2023, 2:31pm UTC](https://discuss.ampl.com/t/connect-matlab-with-ampl/617/2 "2023-06-22T14:31:26Z")

</div>

Hi @Tania_Castellanos,

You need to specify the path to `ampl.exe` (the AMPL interpreter), not `amplide.exe` (the AMPL IDE). The following should work:

```auto
ampl = AMPL('C:\amplbundle.mswin64\ampl.mswin64\ampl.exe');

```

---

<div class="post-metadata">

**Author:** ![Tania\_Castellanos](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/tania_castellanos/32/333_2.png) [@Tania\_Castellanos](https://discuss.ampl.com/u/Tania_Castellanos)\
**Post date:** [June 22, 2023, 2:59pm UTC](https://discuss.ampl.com/t/connect-matlab-with-ampl/617/3 "2023-06-22T14:59:08Z")

</div>

Thank you very much, I didn’t know this. 😄
