(Not recommended) Add analog output channel to session
session object function is not recommended. Use
object functions instead. See Compatibility Considerations.
adds an analog output channel on the device represented by
deviceID, with the specified
and channel measurement type defined by
measurementType, on the
s. Measurement types are vendor-specific.
daq.createSessionto create a session object before you use this method.
To use counter channels, see
creates and returns the channel object
ch = addAnalogOutputChannel(
ch, representing the
channel that was added.
creates and returns the object
ch, representing the channel that
was added, and the object
idx, representing the index into the
array of the session object Channels property.
Add an Analog Output Voltage Channel
s = daq.createSession('ni') addAnalogOutputChannel(s,'cDAQ1Mod2','ao0','Voltage');
Add Analog Output Channel and Return Its Index
s = daq.createSession('ni') [ch,idx] = addAnalogOutputChannel(s,'cDAQ1Mod2','ao0','Voltage');
Add a Range of Analog Output Channels
s = daq.createSession('ni') ch = addAnalogOutputChannel(s,'cDAQ1Mod8',0:3,'Current');
s — Data acquisition session
session object handle
Data acquisition session specified as a session object handle, created
daq.createSession. Create one
session per vendor, and use that vendor session to perform all data
acquisition and generation operations.
deviceName — Device ID
character vector or string
Device ID specified as a character vector or string, as defined by the
device vendor. Obtain the device ID by calling
channelID — Channel ID
numeric value, character vector, or string
Channel ID specified as a numeric value, character vector, or string; or
the physical location of the channel on the device. Supported values are
specific to the vendor and device. You can add multiple channels by
specifying the channel ID as a numeric vector, or an array of character
vectors or strings. The index for this channel
indicates its position in the session display. The channel ID is not the
same as the channel index in the session: if you add a channel with ID
2 as the first channel in a session, the session
channel index is
measurementType — Channel measurement type
character vector or string
Channel measurement type specified as a character vector or string.
measurementType represents a vendor-defined
measurement type. Supported measurement types include:
ch — Analog output channel object
Analog output channel, returned as an object containing a 1-by-n array of vendor-specific channel information. Use this channel object to access device and channel properties.
idx — Channel index
Channel index, returned as a numeric value. With this index, you can access the array of the session object Channels property.
Version HistoryIntroduced in R2010b
session object interface is not recommended
Use of this function with a
session object is not recommended. To
access a data acquisition device, use a
with its functions and properties instead.
For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.