Running freefem from matlab

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?

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

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.

1 Like

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.

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

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

Thank you very much, Zese.

bests
jie

1 Like