# Running freefem from matlab

**URL:** <https://community.freefem.org/t/running-freefem-from-matlab/886>\
**Category:** General Discussion\
**Created:** [April 1, 2021, 8:21am UTC](https://community.freefem.org/t/running-freefem-from-matlab/886 "2021-04-01T08:21:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)\
**Post date:** [April 1, 2021, 8:21am UTC](https://community.freefem.org/t/running-freefem-from-matlab/886/1 "2021-04-01T08:21:09Z")

</div>

Dear all,

I wanted to run freefem from matlab. inside Mathworks this command was proposed:

[file, path] = uigetfile(’\*.edp’);  
selectedFilePath = fullfile(path, file)  
system(['FreeFem++ ’ Path]);  
when I use this command, matlab opens the file location and when I click on the file it try to run it. although the code is right and without error when I run it by cmd, matlab shows error as follow:  
selectedFilePath =

```
' \ '

```

– FreeFem++ v 3.600000 (date mar. 1 mai 2018 13:00:02)  
Load: lg\_fem lg\_mesh lg\_mesh3 eigenvalue  
Error openning file E:\pasche\optimalmanipulationcontrol\AmijoplusSteepestdescentpluseigenvalue\Newfolder\optimalcontrol2 in:  
– try :“E:\pasche\optimalmanipulationcontrol\AmijoplusSteepestdescentpluseigenvalue\Newfolder\optimalcontrol2”  
– try :“F:\Program Files (x86)\FreeFem++\idp\E:\pasche\optimalmanipulationcontrol\AmijoplusSteepestdescentpluseigenvalue\Newfolder\optimalcontrol2”

Error line number 1, in file – unkown --, before token  
lex: Error input openning file  
current line = -1  
Compile error : lex: Error input openning file  
line number :1,

has anyone tried it before?

---

<div class="post-metadata">

**Author:** ![BeniaminBogosel](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BeniaminBogosel](https://community.freefem.org/u/BeniaminBogosel)\
**Post date:** [April 1, 2021, 9:01pm UTC](https://community.freefem.org/t/running-freefem-from-matlab/886/2 "2021-04-01T21:01:54Z")

</div>

You can definitely run FreeFEM from Matlab, but in order to do this, I recommend you to understand how to code it yourself. Take a look at the previous FreeFEM days: [https://freefem.org/ffdays.html](https://freefem.org/ffdays.html)

The presentation of David Fabre: **David Fabre** (IMFT, Toulouse) :  
StabFem, a Matlab/Octave interface to FreeFem

However, as I said, it might be easy to do it yourself. Matlab should be opened (or you should change) to the directory where the FreeFem code lies. Then launch the code with the “system” command as usual.

`system("FreeFem++ YourEdpFile.edp");`

I only have experience on Linux. I don’t know the difficulties of doing this in windows.

---

<div class="post-metadata">

**Author:** ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)\
**Post date:** [April 1, 2021, 9:12pm UTC](https://community.freefem.org/t/running-freefem-from-matlab/886/3 "2021-04-01T21:12:56Z")

</div>

> [@BeniaminBogosel](#):
>
> system(“FreeFem++ YourEdpFile.edp”);

Thanks very much. It helped me very much. I just wrote an editor file and saved it in the same folder where my .edp file was. now it is running.

---

<div class="post-metadata">

**Author:** ![ampleocean](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ampleocean](https://community.freefem.org/u/ampleocean)\
**Post date:** [October 24, 2022, 3:25am UTC](https://community.freefem.org/t/running-freefem-from-matlab/886/4 "2022-10-24T03:25:58Z")

</div>

Hi, May I know where I can download the old version of FreeFem like version 3.56?  
thanks  
jie

---

<div class="post-metadata">

**Author:** ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)\
**Post date:** [October 30, 2022, 7:22pm UTC](https://community.freefem.org/t/running-freefem-from-matlab/886/5 "2022-10-30T19:22:49Z")

</div>

Hi, I have version 3.61. the oldest version is 3.61 which you can download it from github. [https://github.com/FreeFem/FreeFem-sources/releases/download/3.61/FreeFem++-3.61-1-win64.exe](https://github.com/FreeFem/FreeFem-sources/releases/download/3.61/FreeFem++-3.61-1-win64.exe)

---

<div class="post-metadata">

**Author:** ![ampleocean](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@ampleocean](https://community.freefem.org/u/ampleocean)\
**Post date:** [October 31, 2022, 12:46am UTC](https://community.freefem.org/t/running-freefem-from-matlab/886/6 "2022-10-31T00:46:32Z")

</div>

Thank you very much, Zese.

bests  
jie
