The data argument must contain one column for each output channel in the session

2 views (last 30 days)
I'm having trouble understanding what I'm doing wrong that results in this error. It seems like a bug. I've attached a minimum working example below:
>> instrreset; clear all;
>> ao0 = daq.createSession('ni');
>> ao0chan = addAnalogOutputChannel(ao0,'Dev1',0,'Voltage');
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.
>> dio = daq.createSession('ni');
>> addDigitalChannel(dio,'Dev1','Port0/Line0:7','OutputOnly');
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.
>> addDigitalChannel(dio,'Dev1','Port1/Line0:3','OutputOnly');
>> outputSingleScan(dio,[0 0 0 0 0 0 0 0 0 0 0 0])
>> outputSingleScan(dio,[0 0 0 0 0 0 1 0 0 0 0 0])
>> outputSingleScanoutputSingleScan(ao0,1)
>> outputSingleScan(dio,[0 0 0 0 0 0 0 0 0 0 0 0])
The data argument must contain one column for each output channel in the session.
>> dio
dio =
Data acquisition session using National Instruments hardware:
Clocked operations using startForeground and startBackground are disabled.
Only on-demand operations using inputSingleScan and outputSingleScan can be done.
Number of channels: 12
index Type Device Channel MeasurementType Range Name
----- ---- ------ ----------- --------------- ----- ----
1 dio Dev1 port0/line0 OutputOnly n/a
2 dio Dev1 port0/line1 OutputOnly n/a
3 dio Dev1 port0/line2 OutputOnly n/a
4 dio Dev1 port0/line3 OutputOnly n/a
5 dio Dev1 port0/line4 OutputOnly n/a
6 dio Dev1 port0/line5 OutputOnly n/a
7 dio Dev1 port0/line6 OutputOnly n/a
8 dio Dev1 port0/line7 OutputOnly n/a
9 dio Dev1 port1/line0 OutputOnly n/a
10 dio Dev1 port1/line1 OutputOnly n/a
11 dio Dev1 port1/line2 OutputOnly n/a
12 dio Dev1 port1/line3 OutputOnly n/a
Properties, Methods, Events
>> ao0
ao0 =
Data acquisition session using National Instruments hardware:
Clocked operations using startForeground and startBackground are disabled.
Only on-demand operations using inputSingleScan and outputSingleScan can be done.
Number of channels: 1
index Type Device Channel MeasurementType Range Name
----- ---- ------ ------- ------------------- --------------- ----
1 ao Dev1 ao0 Voltage (SingleEnd) 0 to +5.0 Volts
Properties, Methods, Events
>>
I'm using a NIST NI USB-6009 DAQ, if it helps.
  4 Comments
Christopher Stanford
Christopher Stanford on 25 Feb 2019
Some more weirdness. If I clear dio and restart it, it works again, but it breaks ao0 as soon as I write to dio. Then if I clear ao0 and restart ao0, it will break dio again as soon as I write to ao0. Here's some code, continuing from the point in the OP:
>> outputSingleScan(dio,[0 0 0 0 0 0 0 0 0 0 0 0])
The data argument must contain one column for each output channel in the session.
>> clear dio
>> dio = daq.createSession('ni');
>> addDigitalChannel(dio,'Dev1','Port0/Line0:7','OutputOnly');
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.
>> addDigitalChannel(dio,'Dev1','Port1/Line0:3','OutputOnly');
>> outputSingleScan(ao0,1)
>> outputSingleScan(dio,[0 0 0 0 0 0 1 0 0 0 0 0])
>> outputSingleScan(ao0,1)
The data argument must contain one column for each output channel in the session.
>> clear ao0
>> ao0 = daq.createSession('ni');
>> ao0chan = addAnalogOutputChannel(ao0,'Dev1',0,'Voltage');
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.
>> outputSingleScan(dio,[0 0 0 0 0 0 1 0 0 0 0 0])
>> outputSingleScan(ao0,1)
>> outputSingleScan(dio,[0 0 0 0 0 0 1 0 0 0 0 0])
The data argument must contain one column for each output channel in the session.
>>
Walter Roberson
Walter Roberson on 25 Feb 2019
Edited: Walter Roberson on 25 Feb 2019
I have been wondering what would happen if you were to try to write as many elements as were appropriate for the other device set -- so when it is complaining about columns for ao0, would it complain if you tried to send to ao0 12 samples ?

Sign in to comment.

Answers (0)

Categories

Find more on Digital Input and Output in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!