Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

addFunctionGeneratorChannel

Add function generator channel

Before you work with function generator channels, see Supported Hardware and Create a Session.

Syntax

addFunctionGeneratorChannel(s,deviceID,channelID,waveformType)
[ch,idx] = addFunctionGeneratorChannel(s,deviceID,channelID,waveformType)

Description

example

addFunctionGeneratorChannel(s,deviceID,channelID,waveformType) adds a channel on the device represented by deviceID, with the specified channelID and waveformType to the session s.

example

[ch,idx] = addFunctionGeneratorChannel(s,deviceID,channelID,waveformType) creates and displays the object ch, representing the channel that was added and the index, idx, which is an index into the array of the session object Channels property.

Examples

collapse all

Add a channel on a Digilent device with a sine waveform type.

Create a session for Digilent devices.

s = daq.createSession('digilent');

Add a channel with a sine waveform type.

addFunctionGeneratorChannel(s,'AD1',1,'Sine')
ans = 

Data acquisition sine waveform generator '1' on device 'AD1':

          Phase: 0
          Range: -5.0 to +5.0 Volts
 TerminalConfig: SingleEnded
            Gain: 1
         Offset: 0
     SampleRate: 4096
   WaveformType: Sine
           Name: ''
             ID: '1'
         Device: [1x1 daq.di.DeviceInfo]
MeasurementType: 'Voltage'

Create a session for Digilent devices.

s = daq.createSession('digilent');

Add a channel with a sine waveform type.

[ch,idx] = addFunctionGeneratorChannel(s,'AD1',1,'Sine')
ch = 

Data acquisition sine waveform generator '1' on device 'AD1':

          Phase: 0
          Range: -5.0 to +5.0 Volts
 TerminalConfig: SingleEnded
           Gain: 1
         Offset: 0
     SampleRate: 4096
   WaveformType: Sine
           Name: ''
             ID: '1'
         Device: [1x1 daq.di.DeviceInfo]
MeasurementType: 'Voltage'


Properties, Methods, Events


idx =

     1

Input Arguments

collapse all

Data acquisition session, specified as a session object. Create the session object using daq.createSession. Use the data acquisition session for acquisition and generation operations. Create one session per vendor and use that vendor session to perform all data acquisition operations.

Device ID as defined by the device vendor, specified as a character vector or string. Obtain the device ID by calling daq.getDevices. The channel specified for this device is created for the session object.

Channel ID or the physical location of the channel on the device, added to the session, specified as a numeric value, character vector, or string. You can add a range of channels with an array. The index for this channel displayed in the session indicates this channel’s position in the session. If you add a channel with channel ID 1 as the first channel in a session, the session index is 1 because of position, not ID.

Function generator waveform type specified as a character vector or string. Valid waveform types include:

  • 'Sine'

  • 'Square'

  • 'Triangle'

  • 'RampUp'

  • 'RampDown'

  • 'DC'

  • 'Arbitrary'

Data Types: char | string

Output Arguments

collapse all

Analog input channel that you add, returned as an object containing a 1xn array of vendor specific channel specific information. Use this channel object to access device and channel properties.

Channel index returned as a numeric value. Through the index you can access the array of the session object's Channels property.

Introduced in R2014b

Was this topic helpful?