link .dll files with matlab

조회 수: 32 (최근 30일)
Jo
Jo 2015년 5월 27일
댓글: Dasharath Gulvady 2015년 5월 29일
hi I have some .dll files and I would like to link them with Matlab. Is there a way to load and read them in matlab?

채택된 답변

Dasharath Gulvady
Dasharath Gulvady 2015년 5월 28일
You can use "loadlibrary" function to load and use the functions from a C/C++ DLL in MATLAB.
You can use "NET.addAssembly" to load a global .NET assembly in MATLAB:
  댓글 수: 2
Jo
Jo 2015년 5월 29일
Hi! many thanks for your answer. I tried using "loadlibrary" but I got this error:
"Error using loadlibrary (line 253) A 'Selected' compiler was not found. You may need to run mex -setup."
I used the ext=mexext and found out that ext = mexw64
The problem is that my files have to be used with the 32-bit version of IDL. If they can be read by Matlab it would also have to be a 32-bit version of Matlab.
Any ideas?
many thanks in advance
Dasharath Gulvady
Dasharath Gulvady 2015년 5월 29일
If your DLLs are 32-bit, then you can only load them on a 32-bit MATLAB. In any case, you have to select a compiler using "mex -setup"

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

B.k Sumedha
B.k Sumedha 2015년 5월 29일
편집: B.k Sumedha 2015년 5월 29일
It looks like you are using a MEX-function which used to have a .dll extension in very old releases of MATLAB. They now have extensions like mexw32, mexw64, etc. You can call these files directly like any other MATLAB function - there is no need to use LOADLIBRARY.
In any case, the issue is that MEX-files are platform-specific - the one you have is compiled for 32-bit Windows, so it won't be recognized on 64-bit MATLAB. If you have the source code corresponding to the file, you can use the MEX command to re-compile it for 64-bit Windows. Alternately, you can install 32-bit MATLAB on your 64-bit machines to run the 32-bit MEX-file. See How can I install 32-bit MATLAB on my 64-bit Windows machine? in matlab

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by