How to call a Matlab compiled function in Matlab code?
조회 수: 6 (최근 30일)
이전 댓글 표시
I can't find anywhere how I execute from matlab code a compiled function (in matlab).
댓글 수: 0
채택된 답변
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
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 Exchange에서 C Shared Library Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!