Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading LABVIEW DLL File To MATLAB

Hello All,

I have constructed a VI file for digital data acquisition. It's work fine and the recieved data is being saved to a file.
I would like to integrate my LABVIEW file with MATLAB.
I have installed LABVIEW Run Time Engine 7.0, and using LABVIEW application builder I created a *.DLL file from my *.VI file.

The header file generated by the application Builder looks like:

void __cdecl RxSSINum(float timeLimitInSecForSynchronousOperation,
long bufferSize, TD1Hdl *portList, short device, long *AcquiredSamples,
TD2Hdl *Data, long *SyncIndex, LVBoolean *timeOut);

My inputs are : timeLimitInSecForSynchronousOperation, bufferSize, portlist, device
My outputs are : Data, SyncIndex, timeOut

I would like to know how can I load the *.DLL file directly to MATLAB and not VIA C program.

Thank's in advance.
0 Kudos
Message 1 of 5
(4,101 Views)
Hello 0573472951242,

You can find information on how to call a dll from MATLAB® by searching on Google. However, I will recommend you to take a look at the following link:

Calling LabVIEW VIs from The MathWorks Inc. MATLAB®

The link above describes the benefits of using the LabVIEW Math Interface Toolkit (MIT) to convert a LabVIEW VI for use in MATLAB as a MEX-file, which is a customized DLL that MATLAB recognizes.
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
Message 2 of 5
(4,095 Views)
Hello Philip C.

Thanks a lot.

Best Regards,
Nir
0 Kudos
Message 3 of 5
(4,089 Views)
Hi Philip,

I am trying to load LABVIEW *.dll file from MATLAB using MEX MATLAB7.0 file.
In order to do so I used LABVIEW 7.1 and LABVIEW application builder 7.1 to create *.dll file from my *.ni application file.

I used Visual C++ 6.0 in order to load the LABVIEW *.dll. (And it is working fine)
The next step was to create a MEX file (MATLAB *.dll) file.

In MATLAB workspace I used the following command line:

mex *.c *.lib

Were : *.c is the MATLAB MEX dll and the *.lib is the LABVIEW dll lib file which was created by the LABVIEW
Application Builder.

Running the created MEX dll file in MATLAB resulted in un desired received values.
(LABVIEW dll is not running).

My NI-DAQ includes the following drivers:
Traditional NI - DAQ 7.2.0f1
NI - DAQmx 7.2.0f0

I noticed that NI developed MIT application for calling LABVIEW VI's from MATLAB directly, but the are doing automatically the same thing
that I have described here: so I would like to avoid doing it via MIT application.

I added my C source file and my MATLAB MEX file.
With your permission I would like your help in the following subject.

Best Regards,
Nir
0 Kudos
Message 4 of 5
(3,950 Views)
Hi Nir,

Thank you for addressing this question directly to me. However, I'm not familiar with the procedure you have chosen to call LabVIEW code from MATLAB®. I'm not denying that it is a possible approach, but we developed the LabVIEW Math Interface Toolkit (MIT) to avoid the troubles you seem to be facing.

You can still try the "mex *.c *.lib" approach, but I would recommend you to try with an extremely simple DLL(VI) first. Keep all I/O out of the VI to minimize the risk for errors and add functionality step by step.

It would be interesting to know if other customers have been successful using this approach.


Good luck, Nir.
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 5 of 5
(3,931 Views)