| Data Acquisition Toolbox | 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 theaddchannel function.
chans = addchannel(obj, hwch, index, names)
obj is the analog output object.
hwch are the IDs of the hardware channels you are adding to the analog output object. Any valid MATLAB vector syntax can be used to specify the hardware channels.
index (optional) are the MATLAB indices of the hardware channels.
names (optional) are the descriptive names of the hardware channels.
chans (optional) is a vector containing the analog output channels.
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 objectao for a National Instruments board having a device ID of 1.
ao = analogoutput('nidaq', 1)
ao:
addchannel(ao, 0:1)
Example: Adding Channels for a Sound Card
Suppose you create the analog output objectao for a sound card.
ao = analogoutput('winsound')