Contain hardware channels added to device object


Channel is a vector of all the hardware channels contained by an analog input (AI) or analog output (AO) object. Because a newly created AI or AO object does not contain hardware channels, Channel is initially an empty vector. The size of Channel increases as channels are added with the addchannel function, and decreases as channels are removed using the delete function.

Channel is used to reference one or more individual channels. To reference a channel, you must know its MATLAB index, which is given by the Index property. For example, you must use Channel with the appropriate indices when configuring channel property values.

For scanning hardware, the scan order follows the MATLAB index. Therefore, the hardware channel associated with index 1 is sampled first, the hardware channel associated with index 2 is sampled second, and so on. To change the scan order, you can specify a permutation of the indices with Channel.






Data type

Vector of channels

Read-only when running



Values are automatically defined when channels are added to the device object with the addchannel function. The default value is an empty column vector.


Create the analog input object ai for a National Instruments® card and add three hardware channels to it.

ai = analoginput('nidaq','Dev1');

To set a property value for the first channel added (ID = 0), you must reference the channel by its index using the Channel property.

chans = ai.Channel(1);
chans.InputRange = [-10 10]

Based on the current configuration, the hardware channels are scanned in order from 0 to 2. To swap the scan order of channels 0 and 1, you can specify the appropriate permutation of the MATLAB indices with Channel.

ai.Channel([1 2 3]) = ai.Channel([2 1 3]);

See Also


addchannel, delete


HwChannel, Index

Was this topic helpful?