NI Home > Community > NI Discussion Forums

Measurement Studio for VC++

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Rked
Posts: 9
0 Kudos

does return main keeps task still in system and be available for other tasks

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

Member
SEgeler
Posts: 192
0 Kudos

Re: does return main keeps task still in system and be available for other tasks

Hi Rked,

 

how does the "doesn't work" show? Is there an error message? A crash / hang?

 

Regards,

 

Stefan