How can I launch a FreeFem++ (.edp) file from MATLAB 2018b?

3 ビュー (過去 30 日間)
Wael Wanis
Wael Wanis 2019 年 8 月 11 日
編集済み: Wael Wanis 2019 年 8 月 15 日
Hello everyone,
I am working on Creating a GUI using MATLAB App Designer, the user will insert some inputs, click on Run, then some code is executed, then the output figure should appear.
My problem is that the code is executed by FreeFem++ software, so how can I embedd the code in the MATLAB, i mean when the button in the GUi is clicked, how can it automatically open the FreeFem (.edp) file and execute it?
Thank you.

採用された回答

Divya Gaddipati
Divya Gaddipati 2019 年 8 月 14 日
In the ButtonPushed callback function, you can add the following line for executing a .edp file
system(['FreeFem++ ' path_to_file]);
If you want to select a file interactively, you could also use the uigetfile function
[file, path] = uigetfile('*.edp');
selectedFilePath = fullfile(path, file)
system(['FreeFem++ ' selectedFilePath]);
Note: Make sure the folder names in your selectedFilePath do not have spaces.
  1 件のコメント
Wael Wanis
Wael Wanis 2019 年 8 月 15 日
編集済み: Wael Wanis 2019 年 8 月 15 日
Thank you so much.
Both methods worked with me but with a problem,
when I use these three lines:
[file, path] = uigetfile('*.edp');
selectedFilePath = fullfile(path, file)
system(['FreeFem++ ' selectedFilePath]);
after i push the button, the browser opens and i choose the file i want (i made sure there is no space in the names of the folder) then the code is executed and the FreeFem figure appears.
Until now everything is perfect.
However, after these three lines, I have some other lines that I need to execute as well, they aren't executed ! MATLAB is stuck at these three lines and doesn't exit, it keeps running the FreeFem code without exiting.
Same thing happens when I use the other method:
system(['FreeFem++ ' 'C:\Users\Lenovo\OneDrive\Desktop\Trial6\main.edp']);
When MATLAB reaches this line, it executes the FreeFem code and the output FreeFem figure appears, but then the rest of the code isn't executed.
How can I solve this issue?
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by