Data Acquisition Toolbox | ![]() ![]() |
Indicate the MATLAB index of a hardware channel or line
Description
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.
Characteristics
Usage |
AI, AO, Channel; DIO, Line |
Access |
Read-only |
Data type |
Double |
Read-only when running |
N/A |
Values
Values are automatically defined when channels (lines) are added to the device object with the addchannel
(addline
) function. The default value is one.
Example
Create the analog input object ai
for a sound card and add two hardware channels to it.
You can access the MATLAB indices for these channels with Index
.
Functions
Properties
Channel
, HwChannel
, HwLine
, Line
![]() | HwLine | InitialTriggerTime | ![]() |