Specify hardware line ID
Note: You cannot use the legacy interface on 64-bit MATLAB®. See Working with the Session-Based Interface to acquire and generate data on a 64-bit MATLAB.
All lines contained by a digital I/O object have a hardware ID and an associated MATLAB index. The hardware ID is given by HwLine and the MATLAB index is given by the Index property. The HwLine value is defined when hardware lines are added to a digital I/O object with the addline function.
The beginning line ID value depends on the hardware device. For National Instruments® hardware, line IDs are zero-based (begin at zero).
Values are automatically defined when lines are added to the digital I/O object with the addline function. The default value is one.
Suppose you create the digital I/O object dio and add four hardware lines to it.
dio = digitalio('nidaq','Dev1'); addline(dio,0:3,'out');
addline automatically assigns the indices 1-4 to these hardware lines. You can swap the hardware lines associated with index 1 and index 2 with HwLine.
dio.Line(1).HwLine = 1; dio.Line(2).HwLine = 0;