How to call a Matlab compiled function in Matlab code?

4 ビュー (過去 30 日間)
Magi Toneu
Magi Toneu 2018 年 5 月 18 日
コメント済み: Walter Roberson 2018 年 5 月 19 日
I can't find anywhere how I execute from matlab code a compiled function (in matlab).

採用された回答

Kojiro Saito
Kojiro Saito 2018 年 5 月 19 日
For calling compiled standalone applications (execution files created by MATLAB Compiler), just like calling external programs, "!" or "system" commands are used.
For example, if I have magicsquare.exe compiled from magicsquare.m in this example, I can call this exe from MATLAB.
status = system('magicsquare.exe 5');
if status == 0
% Do something when command returns success
else
% Do something when command returns error
end
Or, simply,
!magicsquare.exe 5
might be enough.
  2 件のコメント
Magi Toneu
Magi Toneu 2018 年 5 月 19 日
Thanks, it works correctly. I would like to know how I can get the variable that a function may return.
Walter Roberson
Walter Roberson 2018 年 5 月 19 日
Compiled executables cannot return variables, only status codes.
If you need to compile code and call it from MATLAB you should consider using MATLAB Compiler SDK or MATLAB Coder, rather than compiling it to an independent executable.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by