Call MATLAB-created DLL
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I'm trying to call a MATLAB created DLL-File in MATLAB but the result is not as expected. I found ot that I have to pass 4 arguments to adress the function but still something is wrong? Following code demonstrates the complete process:
%% Function File
% function OUTPUT = FlipMyString(INPUT)
% OUTPUT = fliplr(INPUT);
%% Call-Test of Function
OUTPUT = FlipMyString('TESTSTRING');
%% Create DLL
mcc -g -v -W cpplib:libFlipMyString -T link:lib FlipMyString
%% Call Library
LIBRARY = 'libFlipMyString';
if ~libisloaded(LIBRARY)
loadlibrary(LIBRARY)
end
LIB = libfunctions(LIBRARY);
[A,B,C] = calllib(LIBRARY,LIB{end},1,'teststring',1,'TESTSTRING')
%% Unload Library
unloadlibrary(LIBRARY)
0 commentaires
Réponses (1)
Nagarjuna Manchineni
le 7 Mar 2017
The library (.dll) created using MATLAB cannot be loaded into another MATLAB. A DLL generated by MATLAB Compiler SDK is intended to be used by other applications rather than using it back in MATLAB.
If you would like to share your program with other users who may or may not have MATLAB, you can create an executable using MATLAB Compiler. And, this can be executed in MATLAB using bang operator (!) or System command or from Windows command prompt.
0 commentaires
Voir également
Catégories
En savoir plus sur MATLAB Compiler dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!