MATLAB: Simultaneous digital and analog output using data acquisition toolbox

analogdaqData Acquisition ToolboxdigitalMATLABnisession

Hello,
I am using a NI-DAQ 6216 with Matlab's Data Acquisition Toolbox. The device has two analog output channels and I need to use both simultaneously to output arbitrary waveforms. At the same time, I want to use a digital output to drive an LED that signals when the analog signals are produced.
I tried to follow this example using the session based interface: http://au.mathworks.com/help/daq/generate-signals-on-both-analog-and-digital-channels.html
s = daq.createSession('ni');
addAnalogOutputChannel(s,'Dev1',0:1,'Voltage')
addDigitalChannel(s,'Dev1','Port0/Line0','OutputOnly')
And I get the message:
Warning: A channel that does not support clocked sampling was added to the session. Clocked operations using startForeground and startBackground will be disabled. Only on-demand operations using inputSingleScan and outputSingleScan can be done.
So I can't use startForeground and startBackground, which I need to produce my analog outputs. Is there any way to do what I want?
Sarah

Best Answer

I solved this by setting up two sessions, one for analog and one for digital (I got the idea from http://au.mathworks.com/matlabcentral/answers/24757-daq-session-based-input-is-it-possible-to-have-different-clocks-for-input-and-output).