Data Acquisition Toolbox    

Adding Channels to an Analog Output Object

After creating the analog output object, you must add hardware channels to it. As shown by the figure in Adding Channels or Lines, you can think of a device object as a container for channels. The collection of channels contained by the device object is referred to as a channel group. As described in Mapping Hardware Channel IDs to MATLAB Indices, a channel group consists of a mapping between hardware channel IDs and MATLAB indices (see below).

When adding channels to an analog output object, you must follow these rules:

You add channels to an analog output object with the addchannel function. addchannel requires the device object and at least one hardware channel ID as input arguments. You can optionally specify MATLAB indices, descriptive channel names, and an output argument. For example, to add two hardware channels to the device object ao created in the preceding section:

The output argument chans is a channel object that reflects the channel array contained by ao. You can display the class of chans with the whos command.

You can use chans to easily access channels. For example, you can easily configure or return property values for one or more channels. As described in Referencing Individual Hardware Channels, you can also access channels with the Channel property.

Once you add channels to an analog output object, the properties listed below are automatically assigned values. These properties provide descriptive information about the channels based on their class type and ID.

Table 6-2: Descriptive Analog Output Channel Properties 
Property Name
Description
HwChannel
Specify the hardware channel ID.
Index
Indicate the MATLAB index of a hardware channel.
Parent
Indicate the parent (device object) of a channel.
Type
Indicate a channel.

You can display the values of these properties for chans with the get function.

To reference individual channels, you must specify either MATLAB indices or descriptive channel names. Refer to Referencing Individual Hardware Channels for more information.


  Creating an Analog Output Object Configuring Analog Output Properties