addline - Add hardware lines to digital I/O object

Syntax

lines = addline(obj,hwline,'direction')
lines = addline(obj,hwline,port,'direction')
lines = addline(obj,hwline,'direction','names')
lines = addline(obj,hwline,port,'direction','names')

Arguments

obj

A digital I/O object.

hwline

The numeric IDs of the hardware lines added to the device object. Any MATLAB® vector syntax can be used.

'direction'

The line directions can be In or Out, and can be specified as a single value or a cell array of values.

port

The numeric IDs of the digital I/O port.

'names'

A descriptive line name or cell array of descriptive line names.

lines

A column vector of lines with the same length as hwline.

Description

lines = addline(obj,hwline,'direction') adds the hardware lines specified by hwline to the digital I/O object obj. direction configures the lines for either input or output. lines is a row vector of lines.

lines = addline(obj,hwline,port,'direction') adds the hardware lines specified by hwline from the port specified by port to the digital I/O object obj.

lines = addline(obj,hwline,'direction','names') adds the hardware lines specified by hwline to the digital I/O object obj. names is a descriptive line name or cell array of descriptive line names.

lines = addline(obj,hwline,port,'direction','names') adds the hardware lines specified by hwline from the port specified by port to the digital I/O object obj. direction configures the lines for either input or output. names is a descriptive line name or cell array of descriptive line names.

Remarks

Rules for Adding Lines

More About MATLAB® Indices

Every hardware line contained by a device object has an associated MATLAB index that is used to reference the line. Index assignments are made automatically by addline and follow these rules:

More About Descriptive Line Names

You can assign hardware lines descriptive names, which are stored in the LineName property. Choosing a unique descriptive name can be a useful way to identify and reference lines. For a single call to addline, you can

If the number of names specified in a single addline call is more than one but differs from the number of lines to be added, then an error is returned. If a line is to be referenced by its name, then that name must not contain symbols. If you are naming a large number of lines, then the makenames function might be useful. If a line is not assigned a descriptive name, then it must be referenced by index.

Examples

Create the digital I/O object dio and add the first four hardware lines (line IDs 0-3) from port 0.

dio = digitalio('nidaq','Dev1');
addline(dio,0:3,'in');

These lines are automatically assigned the indices 1-4. If you want to add the first four hardware lines to dio and assign descriptive names to the lines,

addline(dio,0:3,'in',{'line1','line2','line3','line4'});

Note that you can use the makenames function to create a cell array of line names. You can add the first four hardware lines (line IDs 0-3) from port 1 to the existing line group.

addline(dio,0:3,1,'out');

The new lines are automatically assigned the indices 5-8.

See Also

Functions

delete, makenames

Properties

HwLine, Index, LineName

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS