Queues data to be output
This function is part of analog scan functionality and has to be called in the following sequence:
Initialize scanning session - mdaqAOScanInit()
Start scanning session - mdaqAOScan()
Queue new data - mdaqAOScanData()
Stop scanning session - mdaqAOScanStop()
This function queues data to be output. A function call has to be preceded with mdaqAOScanInit(). Function queues data in the stream and periodic mode and its behavior depends on selected scan mode. In periodic mode, the function can queue data for every channel combination from used channels (defined in mdaqAOScanInit()). If e.g. in scanning session four channels are used: 1, 2, 3, 4 mdaqAOScanData() can be called to queue data for 1 or 4 or 1,2 or 1,4, or 3,4 etc. channel or queue data for all selected channels. In periodic mode channels argument can contain every combination of used channels, while in stream mode channel argument must be the same as used in mdaqAOScanInit(). The data argument in stream mode must have the same size as the data argument in function mdaqAOScanInit(). The mdaqAOScanInit() perform initial data queue operation. The periodic mode uses a single buffer which data is output from. When the end of the buffer is reached, data index is switched to the beginning of the buffer. The mdaqAOScanData() function overwrites the whole buffer with new data. Depending on the scanning mode opt argument has a different meaning. When the periodic mode is used opt argument allows controlling data index after queuing data. When opt=%T data index will be set to the beginning of the buffer. If opt=%F queue operation doesn't affect data index.
When stream mode is used opt argument determines blocking or non-blocking operation of mdaqAOScanData(). The blocking operation (opt=true) will block Matlab console until data is queued. The stream mode uses two buffers to ensure uninterrupted analog signal generation. Queuing data is only possible when one buffer is empty, if both are queued function will wait(opt=true) or return negative result(opt=false). In blocking mode mdaqAOScanData() has 1 second time-out. If non-blocking operation (opt=false) is used function will return immediately with result containing a number of queued data.
Data has to be queued before data index reaches the end of previously queued data. Otherwise, last value will remain on analog output.
channels: channel vector
data: Output data values, specified as an m-by-n matrix, where m is the number of scans to generate, and n is the number of used output channels. Must be same size as initial data argument in mdaqAOScanInit()
opt: Reset data index after upload (Periodic mode). Blocking / non-blocking operation (Stream mode) (true / false)
Queue output data (initial data) for a single channel in periodic mode
Queue output data (initial data) for multiple channel in periodic mode
Generate sine waveform (AO1) with increasing amplitude and acquire data from analog input (AI1) simultaneously. In this example analog output session uses stream mode. Analog output data (sine waveform) is queued in the loop. Using blocking mode for analog output and input sessions ensures function call synchronization.