Main Content

addAnalogOutputChannel

(Not recommended) Add analog output channel to session

This session object function is not recommended. Use DataAcquisition object functions instead. See Compatibility Considerations.

Description

example

addAnalogOutputChannel(s,deviceName,channelID,measurementType) adds an analog output channel on the device represented by deviceID, with the specified channelID, and channel measurement type defined by measurementType, on the session object s. Measurement types are vendor-specific.

example

ch = addAnalogOutputChannel(s,deviceName,channelID,measurementType) creates and returns the channel object ch, representing the channel that was added.

example

[ch,idx] = addAnalogOutputChannel(s,deviceName,channelID,measurementType) 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.

Examples

collapse all

s = daq.createSession('ni')
addAnalogOutputChannel(s,'cDAQ1Mod2','ao0','Voltage');
s = daq.createSession('ni')
[ch,idx] = addAnalogOutputChannel(s,'cDAQ1Mod2','ao0','Voltage');
s = daq.createSession('ni')
ch = addAnalogOutputChannel(s,'cDAQ1Mod8',0:3,'Current');

Input Arguments

collapse all

Data acquisition session specified as a session object handle, created using daq.createSession. Create one session per vendor, and use that vendor session to perform all data acquisition and generation operations.

Device ID specified as a character vector or string, as defined by the device vendor. Obtain the device ID by calling daq.getDevices.

Data Types: char | 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 1.

Channel measurement type specified as a character vector or string. measurementType represents a vendor-defined measurement type. Supported measurement types include:

  • 'Voltage'

  • 'Current'

Data Types: char | string

Output Arguments

collapse all

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.

Channel index, returned as a numeric value. With this index, you can access the array of the session object Channels property.

Version History

Introduced in R2010b

collapse all

R2020a: 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 DataAcquisition object with its functions and properties instead.

For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.