Data Acquisition Toolbox | ![]() ![]() |
Specify the hardware channel ID
Description
All channels contained by a device object have a hardware channel ID and an associated MATLAB index. The channel ID is given by HwChannel
and the MATLAB index is given by the Index
property. The HwChannel
value is defined when hardware channels are added to a device object with the addchannel
function.
The beginning channel ID value depends on the hardware device. For National Instruments hardware, channel IDs are zero-based (begin at zero). For Agilent Technologies hardware and sound cards, channel IDs are one-based (begin at one).
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 HwChannel
.
Characteristics
Usage |
AI, AO, Channel |
Access |
Read/write |
Data type |
Double |
Read-only when running |
Yes |
Values
Values are automatically defined when channels are added to the device object with the addchannel
function. The default value is one.
Example
Create the analog input object ai
for a National Instruments board and add the first three hardware channels to it.
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 assign these channels to the appropriate indices using HwChannel
.
Functions
Properties
![]() | EventLog | HwLine | ![]() |