LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ni-daqmx stand-alone matlab

Dear all,

 

I am about to compile my matlab code into a stand-alone program, which works fine. However, as soon as I start the data acquisition the program fails to initialize the DAQ-board.

 

I'm using the NI-9201 USB-ADC in combination with the NIDAQmx driver.

 

I localized the problem: When trying to initialize the ADC the program fails, since the required dll's are not available. I also localized the dll's and copied them into reach for the stand-alone, but it doesnt work.

As long as the MATLAB\toolbox\daq\daq\private folder is reachable for the programm/Windows, the software works. However, on the custumers computer I dont want to have MATLAB installed (what sense does it makes to have the option for distributing a stand alone version if the customer has to buy a MATLAB licence?). 

 

Can anybody help me solving this problem?  Are there any dll's I may copy into reach of the stand-alone? 

 

(Just as information:  The NI - Measurement and Automation was installed on the "customer-computer", In fact it was the exact same computer with the only difference that I renamed the MATLAB folder)

 

I'm looking forward to your suggestions!

 

    Bastian

 

0 Kudos
Message 1 of 6
(4,398 Views)

Hi Bastian200,

 

Is there not an option to include a MATLAB run-time license when you build your MATLAB code? I am not sure about the MATLAB licensing so I couldn't really comment. Alternatively, if you cannot get hold of a MATLAB license to run your MATLAB code  you could develop a LabVIEW program that uses a Mathscript node to run mathematical programs. You could then distribute this as the LabVIEW run time engine can be included when you build an application.

 

Which MATLAB toolboxes are you using?

 

Thanks,

 

Andrew McLennan
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(4,376 Views)

The MTALAB toolbox of question is the dataacquisition toolbox, everything else works fine

 

 

The Matlab run-time is not the problem in generell, since everything except of the NIdaqmx-dll's is linked in the program. Here a short description how it works in matlab. 

- you write code, GUI's etc. and test the program in Matlab

- then you compile the application into a stand-alone

- if you hand it to a thrid person that has no Matlab licence, you also distribute the MATLAB-Runtime-Environment (MRE)

- the person installes this freely-distributable MRE on his computer and then runs the compiled program

 

All functions in the program are able to run, except of the NIdaqmx. As soon as I the program tries to communicate to the ADC (i.e. open a channel) the program fails. However, when I provide the dll's mentioned in the exact same directory as they were in Matlab, it works. So I'm not sure what tells the MRE that the dll's are in that folder, since it didn't work, when I just copied the dll's in the run-time directory of the stand alone. 

 

Since the program that I would like to distribute is quite complex, re-writing the hole thing in LABView is not an option for me (also, I have no experience with LabView at all, which would require some time to get into it).

 

The solution I aim for would be:

 

1st (best solution)

I just do something in the program to have the dll's compiled and linked to in the stand-alone

 

2nd

when installing the program I provide the dll's. (But I dont want to provide them in the folder ..\MATLAB\...\daq\daq\private\...)

 

 If you dont have the experience with matlab, do you know someone I could ask for this?  Maybe a Matlab forum that addresses NI-ADC questions?

 

Thank you for your support!

 

   Sebastian

0 Kudos
Message 3 of 6
(4,342 Views)

Hi bastian200,

 

maybe this forum post helps:

http://forums.ni.com/ni/board/message?board.id=250&message.id=10165

 

First step
Start by loading the NI dll:
funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni')
(You can choose any alias as long as it is a legal variable name.)
If your version of Matlab is too old to provide the "loadlibrary" function directly, download it here:
http://www.codeproject.com/dll/MatlabGenericDll.asp?df=100&forumid=26247&exp=0&select=972623
After importing, you see the list of available functions.
You can also display them by
libfunctionsview('myni')

 

 Maybe the loadlibrary function is the one you are looking for. Otherwise try contacting Mathworks and ask how to include DLLs in your compiled program.

 

Andreas Stark

Applications Engineer
National Instruments

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 4 of 6
(4,329 Views)

Maybe also his post from the Mathworks forum helps:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/144010 -  loadlibrary and matlab compiler

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 5 of 6
(4,323 Views)

Thank you for the support.

 

I have solved the Problem by installing the 8.74 Version of the NI-ADC driver. That version makes the dll's available as it seems. 

 

However, if I find the time I will also try the loadlibrary approach.

 

 

Again, thank you for your support!

 

Sebastian

0 Kudos
Message 6 of 6
(4,292 Views)