Main Content


(Not recommended) Add analog input channel

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



addAnalogInputChannel(s,deviceID,channelID,measurementType) adds a channel on the device represented by deviceID, with the specified channelID, and channel measurement type represented by measurementType, to the session s. Measurement types are vendor-specific.


ch = addAnalogInputChannel(s,deviceID,channelID,measurementType) creates and returns the channel object ch.


[ch,idx] = addAnalogInputChannel(s,deviceID,channelID,measurementType) creates and returns the object ch, representing the channel that was added, and the index idx, which is an index into the array of the session object Channels property.


collapse all

s = daq.createSession('ni')
s = daq.createSession('ni')
[ch,idx] = addAnalogInputChannel(s,'cDAQ2Mod6','ai0','Thermocouple')
s = daq.createSession('ni')
ch = addAnalogInputChannel(s,'cDAQ1Mod1',[0 2 4],'Voltage');

Input Arguments

collapse all

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

For a list of relevant session object properties, see the following Tips.

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 in the session display indicates the position of this channel in the session. This channel ID is not the same as 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. Valid measurement types include:

  • 'Voltage'

  • 'Thermocouple'

  • 'Current'

  • 'Accelerometer'

  • 'RTD'

  • 'Bridge'

  • 'Microphone'

  • 'IEPE'

Not all devices support all types of measurement.

Data Types: char | string

Output Arguments

collapse all

Analog input channel that you add, 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.


The relevant properties of the data acquisition session are:

ADCTimingModeSet channel timing mode
BridgeModeSpecify analog input device bridge mode
CouplingSpecify input coupling mode
DeviceChannel device information
ExcitationCurrentCurrent of external source of excitation
ExcitationSourceExternal source of excitation
ExcitationVoltageVoltage of excitation source
ExternalTriggerTimeoutSpecify maximum wait time for external trigger
IDID of channel in session
MaxSoundPressureLevelSound pressure level for microphone channels
MeasurementTypeChannel measurement type
NameSpecify descriptive name for the channel
NominalBridgeResistanceResistance of sensor
R0Specify resistance value
RTDConfigurationSpecify wiring configuration of RTD device
RTDTypeSpecify sensor sensitivity
RangeSpecify channel measurement range
ScansAcquiredNumber of scans acquired during operation
SensitivitySensitivity of an analog channel
ShuntLocationIndicate location of channel’s shunt resistor
ShuntResistanceResistance value of channel’s shunt resistor
TerminalConfigSpecify terminal configuration
ThermocoupleTypeSelect thermocouple type
UnitsSpecify unit of RTD measurement

Version History

Introduced in R2010b

expand all