MATLAB: NI DAQ analog output regeneration

analog outputdaqinstrument controlni-daq

Using an NI USB 6366 DAQ to generate a continuous output analog waveform, I keep getting underflow errors "Output underflow event: Last valid output was scan number 199977121". The output sample frequency is 2 MHz, and I have tried all sorts of different buffer sizes. In Labview, I can change the "allow regeneration" mode for analog outputs to allow the DAQ to just loop the onboard FIFO without requiring fresh data from the host computer. How do I do this in matlab? The waveform needs to be continously output for hours at a time, so this instability is really a problem.

Best Answer

In case someone else stumbles on this, there is a low-level function daq.ni.NIDAQmx.DAQmxSetWriteRegenMode that allows you to directly modify this setting in the DAQ.