How to call a Matlab compiled function in Matlab code?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Magi Toneu
am 18 Mai 2018
Kommentiert: Walter Roberson
am 19 Mai 2018
I can't find anywhere how I execute from matlab code a compiled function (in matlab).
0 Kommentare
Akzeptierte Antwort
Kojiro Saito
am 19 Mai 2018
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 Kommentare
Walter Roberson
am 19 Mai 2018
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!