12-23-2008 02:07 PM
I have LV 8.5, and am unable to use a matlab compiled DLL in my LV code. I have tried the 'import' command, but it does not list any functions. However, it does not show any errors during its execution. The existing solutions/responses to this question do not work either. I would also like to know of a way to deal with mxArray datatype. What is its equivalent in C (or any other high-level language) ? How do I retrieve an array that is returned from the matlab dll ?
12-23-2008 09:54 PM
12-24-2008 02:49 PM
I'm assuming you have either Matlab installed or at the very least the Matlab Runtime, otherwise the DLL won't work. The "import" command relies on having a header file. Do you have one? You also need to make sure the DLL has been compiled so that it's compatible with LabVIEW. The most likely problem is name mangling, which also occurs when you try to compile a DLL written in C++. See this post, which contains links to useful posts.
The mxArray datatype is a special datatype which is actually a structure. It's complicated. Your best bet is to create a C DLL that acts as an intermediary between the Matlab DLL and LabVIEW. If you are able to, you can, instead, simply call the Matlab code directly using the Matlab script node.
12-24-2008 05:22 PM
12-24-2008 05:23 PM
12-24-2008 06:23 PM
02-01-2013 01:44 PM
Can anyone provide any example code for creating a wrapper DLL to call a Matlab DLL ... to avoid whole mxArray issue? Creating a wrapper DLL is a major hassle, and I'm not even convinced it'll work.
02-04-2013 12:17 PM
Hi josborne,
This thread hasn't been updated in several years, you may want to start a new thread on this issue.
02-20-2013 01:12 PM
To answer my own post:
As it turns out, a solution to the mxArray problem is to have your Matlab function use bounded arrays (eg fixed length) instead of unbounded.
Fixed length arrays do not use the mxArray struct. They are standard pointers which LabVIEW can directly convert to LabvIEW array datatypes.