Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 

Adding Channels to an Analog Output Object

After creating the analog output object, you must now add channels to it. As shown in the figure on page 2-10, a device object can be thought of as a "container" for channels. Adding channels to the analog output object is accomplished with the addchannel function.

where:

Note:
Adding channels to a sound card involves certain device-specific restrictions. These restrictions are explained in the example on page 3-7.

The collection of channels contained by the device object is referred to as a channel group. Channel group members must all reside on the same hardware device and the channels are all sampled at the same rate. It is important to remember that when you add channels to an object, you are mapping physical hardware channels on your analog output hardware device to MATLAB indices. This mapping allows a certain amount of flexibility in terms of ordering the channels as described by these rules:

If no indices are specified with addchannel, they are automatically defined such that the indices are monotonically increasing and contain no gaps. Each channel is referenced by its position in the list (its index), or optionally by its name if one is defined. Named channels are discussed in "Reference by Channel Name". For detailed information about addchannel, refer to Chapter 6, "Function Reference."

Example: Adding Channels for National Instruments Hardware

Suppose you create the analog output object ao for a National Instruments board having a device ID of 1.

To perform any data acquisition task, you must add hardware channels to the device object. Many National Instruments E-series boards have two output channels that can be added. To add two channels to ao:

These channels are automatically assigned the MATLAB indices 1 and 2.

Note that the channel scanning order is given by the MATLAB indices. Therefore, hardware channel 0 is sampled first and hardware channel 1 is sampled second.

Example: Adding Channels for a Sound Card

Suppose you create the analog output object ao for a sound card.

To perform any data acquisition task, you must add hardware channels to the device object. Most sound cards have just two output channels that can be added. If one channel is added, the sound card is said to be in mono mode. If two channels are added, then the sound card is said to be in stereo mode. The rules for adding these two channels differ from those of other data acquisition devices. These rules are described on page 3-7.



[ Previous | Help Desk | Next ]