03-20-2008 07:26 AM
08-14-2008 12:57 PM
hi all! hope someone is still reading this thread...
i have some linking problems when i use nidaqmx.h and nidaqmx.lib
i want to write S-function for simulink (trying to send and read signal from NI6009 card)
program works fine with VS6...but when i try to compile/link with mex i get the folowing output:
mex timesx.c
Writing library for timesx.mexw32
c:\docume~1\xp\locals~1\temp\mex_4ab63cc4-470f-4500-6492-9e8334653c26\timesx.obj .text: undefined reference to '_DAQmxCreateTask@8'
c:\docume~1\xp\locals~1\temp\mex_4ab63cc4-470f-4500-6492-9e8334653c26\timesx.obj .text: undefined reference to '_DAQmxCreateAOVoltageChan@36'
c:\docume~1\xp\locals~1\temp\mex_4ab63cc4-470f-4500-6492-9e8334653c26\timesx.obj .text: undefined reference to '_DAQmxWriteAnalogF64@36'
c:\docume~1\xp\locals~1\temp\mex_4ab63cc4-470f-4500-6492-9e8334653c26\timesx.obj .text: undefined reference to '_DAQmxWaitUntilTaskDone@12'
c:\docume~1\xp\locals~1\temp\mex_4ab63cc4-470f-4500-6492-9e8334653c26\timesx.obj .text: undefined reference to '_DAQmxStopTask@4'
c:\docume~1\xp\locals~1\temp\mex_4ab63cc4-470f-4500-6492-9e8334653c26\timesx.obj .text: undefined reference to '_DAQmxClearTask@4'
C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of 'timesx.mexw32' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
i have both nidaqmx.h and nidaq.lib in working directory...i also tried to copy this files in default matlab lib/incluide dirs but the same problem occures
this is linker problem i think...
any solutions/examples???
btw ... working on WinXP,MatLab 2007b,VS6
03-31-2009 08:25 AM
08-06-2009 09:06 AM
Since I want to use the NIDaqmx without the use of Matlab's DAT, I'm struggling with all the tutorials posted here.
However, I get the error message:
"The datatype and size of the value must be defined before the value can be retrieved."
when the "calllib('nicaiu','DAQmxCreateAIVoltageChan',get(handle.taskh1,'Value'),....." is called.
It has something to do that I have to tell the object by the setdatatype method how to interpret the raw data it received from the function.
Why does this code work for others and not for me? How can I fix this?
I use Matlab 7.5
thnx in advance.
08-07-2009 02:14 AM
To continue my previous question.
If I run Jens_DE's code, I got the error code "-200088" refering to DAQmxErrorInvalidTask. In addition, when the nicaiu library is loaded I always get this warning:
Matlab: Load nicaiu.dll
Warning: Warnings messages were produced while parsing. Check the functions you
intend to use for correctness. Warning text can be viewed using:
[notfound,warnings]=loadlibrary(...)
The warning says:
Failed to parse type '...' original input ' ...'
Found on line 2487 of input from line 2489 of file H:\Program_Projects\Sandbox\nidaqmx\NIDAQmx.h
Error parsing argument for function XXXXXXXXXXXX function may be invalid.
The XXXXXXXXXXX refers to the following functions:
DAQmxGetTaskAttribute
DAQmxGetChanAttribute
DAQmxSetChanAttribute
DAQmxGetTimingAttribute
DAQmxSetTimingAttribute
DAQmxGetTimingAttributeEx
DAQmxSetTimingAttributeEx
DAQmxGetTrigAttribute
DAQmxSetTrigAttribute
DAQmxGetReadAttribute
DAQmxSetReadAttribute
DAQmxGetWriteAttribute
DAQmxSetWriteAttribute
DAQmxGetExportedSignalAttribute
DAQmxSetExportedSignalAttribute
DAQmxGetScaleAttribute
DAQmxSetScaleAttribute
DAQmxSetBufferAttribute
DAQmxSetSwitchChanAttribute
DAQmxGetSwitchDeviceAttribute
DAQmxSetSwitchDeviceAttribute
DAQmxSetSwitchScanAttribute
DAQmxGetDeviceAttribute
DAQmxCreateWatchdogTimerTask
DAQmxGetWatchdogAttribute
DAQmxSetWatchdogAttribute
DAQmxGetCalInfoAttribute
DAQmxSetCalInfoAttribute
DAQmxGetPhysicalChanAttribute
DAQmxGetRealTimeAttribute
DAQmxSetRealTimeAttribute
DAQmxGetPersistedTaskAttribute
DAQmxGetPersistedChanAttribute
DAQmxGetPersistedScaleAttribute
DAQmxGetSystemInfoAttribute
DAQmxSetDigitalPowerUpStates
DAQmxSetAnalogPowerUpStates
These functions were not called directly in Jens_DE's code. Would the problem of DAQmxErrorInvalidTask still has to be found in the "Failed to parse type '...' original input ' ...'"? Does anybody has a clue?
Thanx again!
Kees
01-12-2010 07:32 AM
Hi!!
I've got the same problem! Did anyone get to solve this?, because I've tried to used MEX files of my own calling using the nidaqmx.lib but when I start the
task i get the error 20088 as well. And trying with loadlibrary an nicaiu.dll i get the same warning as the last post.
Please help/
Thanks!
01-18-2010 09:07 AM
The code give me the same error !!
If somebody help i will be gradefull.
01-18-2010 09:10 AM - edited 01-18-2010 09:11 AM
01-27-2010 07:37 PM
First, I'd like to thank the originator of this thread. Using your code, I have been able to get Matlab 7.1 to successfully collect data from an NI USB-6259. But there's one thing left for me to do. In my setup, I have a device (a nerve stimulator) that outputs a digital trigger to the USB-6259 on the PFI0 channel. I have the code set to look for a falling edge trigger because the stimulator's trigger defaults at +5V and drops to 0V when a stimulus pulse occurs. The software controlling the stimulator is Simulink, and the way it works is that it delivers P number of pulses at a frequency of F. P and F are user-defined. For each stimulus pulse, there is a nearly synchronous trigger event. I need to collect all the data (EMG from various stimulated muscles) relative to these pulses (and hence, relative to the triggers).
Suppose P = 10 pulses and F = 5 Hz. Then There will be 10 pulses at a rate of 5 pulses/second so the total duration of stimulation is 2 seconds (more or less). Anyway, I have the Matlab script set up to be triggered on a falling edge and to collect 2 seconds worth of data at whatever sampling frequency that I want (in this case, 1 KHz). BUT, I want to separate out the EMG (voltage measured on AI0) resulting from each stimulus. The problem is, I don't know exactly when those stimuli occur. So here's my question:
1) Is it possible to also pull in the trigger signal from the DAQ board? If I could get that signal (without wasting one of the analog input channels), then I could analyze it for each time the voltage drops from +5 to 0. Finding those times, I would be able to parse up the data vector that gets read in from the DAQ board into a 10-column vector representing the data that is read between each stimulus pulse.
2) If this isn't possible, is it possible to get the times of the falling edge triggers? From what I can tell, the system sees the 1st of the 10 falling triggers and the buffer fills with data from that point (relative time=0). So if I could find out when the other falling triggers were during the train of triggers (relative time=.2s, .4s, .6s, ...), then I would be able to split up the data as I indicated previously.
Any ideas? Which function(s) should I call. I pretty much used exactly what was posted at http://www.jr-worldwi.de/work/matlab/index.html in the "NImess" function.
I would sincerely appreciate your insight.
Thanks,
Matthew
04-26-2010 05:30 PM