03-21-2012 11:31 AM
Hello out there,
I'm heavily stuck to a difficult problem:
Currently I work on a project that is realized in Matlab. So I have Matlabcode that needs to access a NI acquisition card. This is done via MatlabExecutable (short: mex). This just creates a dll file from a cpp file:
Matlab code -> C file-> NI card.
The problem is that normally - in a single c file - you create a task, configure it, start acquisition, check for errors, exiting c code.
BUT, I have following situation:
Matlab -> create_task (configure, etc) -> NI
Matlab -> start_acquisition -> NI
Matlab -> cleanup -> NI
So I need to get the taskHandle from each step. And here I'm stucked. It doesnt work.
Matlab -> create task -> NI: everthing is fine I got all parameters created and I receive the task Handle back to Matlab
Matlab -> start_acq -> NI: I hand over the task Handle but the function DAQmxLoadTask(handle) doesnt work.
Besides my implementation, would it work?? Will the task still be in the system if the c file runs through without cleaning/destoying the task?
And could the DAQmxLoadTask function retrieve it?
Regards
Rked
03-23-2012 05:19 AM
Hi Rked,
i don't use Matlab for DAQ-Applications, but maybe there is another solution. National instruments provides a so called NI-DAQmx Tool which seems to be the better way to use Hardware from National Instruments with Matlab
An Introduction to NI-DAQmx Tools for Data Acquisition with The Mathworks, Inc. MATLAB® Software - Developer Zone - National Instruments
http://zone.ni.com/devzone/cda/tut/p/id/3005
Regards,
Stephan