06-20-2007 03:18 PM
06-21-2007 06:05 PM
Hi Mark,
It looks
like you need the wrapper DLL because there are differences in the way that
MATLAB and LabVIEW store data. It has
also been noted that there is some sort of MATLAB Run-time engine. I would take a look at these forum topics,
and if you are still unable to create a wrapper in C/C++, let me know. There may also be some resources from Mathworks.
http://forums.ni.com/ni/board/message?board.id=170&message.id=29793&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=91847&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=147690&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=203572&requireLogin=False
Trey B
Applications
Engineering
National
Instruments
07-31-2007 02:53 PM
I've been trying to do the same thing, and have just about tried every example listed on NI and Mathwork's websites.
The last attempt I made was to follow the procedure in http://www.mathworks.com/support/solutions/data/1-2Q3TJ5.html?product=CO&solution=1-2Q3TJ5.
Here it talks about compiling a simple code for use with a win32 console application. I started with a trial version of the Matlab compiler (ver. 2007a), and followed the build instructions for Matlab. Then I opened up MSVS 2005 and created a new project. Here I selected a win32 application instead of a console application (so I could choose a DLL). After following all the steps, I built the solution and ended up with a test.dll shared library. Next, I made a vi and inserted a code interface node, and tried to configure the DLL. My impression was all I needed to do was select the test.dll and add the arguments. But that doesn't seem to be the case. I even tried putting the matlab dll and lib in the same directory as the test.dll. That didn't work either. I switched back to the matlab dll, and it still fails. I can't seem to figure it out. Since I've got Matlab and Labview on the same machine, I'm assuming I don't need to install the mcr on my computer. I understand that if I move to another machine, I'd have to do that somehow. Also note that I'm using LV 7.1.
Any help would be greatly appreciated. As I said, I followed all the instructions in the Matlab example (save making it a dll instead of a console app). I seem to be missing something.
08-01-2007 10:28 AM
08-01-2007 10:48 AM
Trey,
I have looked at the forums discussing wrapper DLLs. I specifically tried the one specified in the Matlab example (foowrap.c). My impression was you add this code to your original library and build them together. That way, all the code gets built into a single DLL, with the wrapper talking to the library I built with the Matlab compiler.
The process as I understand it is:
1) Write Matlab m-file.
2) Build dll with Matlab compiler.
3) Create new dll with MSVS 2005.
4) Include library files and write wrapper code for the function.
5) Build the solution to a new dll.
6) Use a code interface node in Labview to talk to the MSVS 2005 dll.
Is this not the correct approach to getting it to work? Thanks for responding by the way!