MATLAB index of hardware channel or line
Note: You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.
Every hardware channel (line) contained by a device object has an associated MATLAB index that is used to reference that channel (line). For example, to configure property values for an individual channel, you must reference the channel through the Channel property using the appropriate Index value. Likewise, to configure property values for an individual line, you must reference the line through the Line property using the appropriate Index value.
For channels (lines), you can assign indices automatically with the addchannel (addline) function. Channel (line) indices always begin at 1 and increase monotonically up to the number of channels (lines) contained by the device object. For channels, index assignments can also be made manually with the addchannel function.
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 assign the channel IDs to different indices using the HwChannel or Channel property.
Index provides a convenient way to access channels and lines programmatically.
AI, AO, per channel; DIO, per line
Read-only when running
Values are automatically defined when channels (lines) are added to the device object with the addchannel (addline) function. The default value is one.
Create the analog input object ai for a sound card and add two hardware channels to it.
ai = analoginput('winsound'); chans = addchannel(ai,1:2);
You can access the MATLAB indices for these channels with Index.
Index1 = chans(1).Index; Index2 = chans(2).Index;