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.

Channels

Array of channel objects associated with session object

Description

This session object property contains and displays an array of channels added to the session. For more information on the session-based interface, see Hardware Discovery and Session Setup.

Tip

You cannot directly add or remove channels using the Channels object properties. Use addAnalogInputChannel and addAnalogOutputChannel to add channels. Use removeChannel to remove channels.

Values

The value is determined by the channels you add to the session object.

Example

Access Channels Property

Create both analog and digital channels in a session and display the Channels property.

Create a session object, add an analog input channel, and display the session Channels property.

s = daq.createSession('ni');
aich = addAnalogInputChannel(s,'cDAQ1Mod7',0,'Bridge');
aich = 

Data acquisition analog input channel 'ai0' on device 'cDAQ1Mod7':

             BridgeMode: Unknown
       ExcitationSource: Internal
      ExcitationVoltage: 2.5
NominalBridgeResistance: 'Unknown'
                  Range: -0.025 to +0.025 VoltsPerVolt
                   Name: ''
                     ID: 'ai0'
                 Device: [1x1 daq.ni.CompactDAQModule]
        MeasurementType: 'Bridge'
          ADCTimingMode: HighResolution

Add an analog output channel and view the Channels property.

aoch = addAnalogOutputChannel(s,'cDAQ1Mod2', 'ao1', 'Voltage')
aoch = 

Data acquisition analog output voltage channel 'ao1' on device 'cDAQ1Mod2':

 TerminalConfig: SingleEnded
          Range: -10 to +10 Volts
           Name: ''
             ID: 'ao1'
         Device: [1x1 daq.ni.CompactDAQModule]
MeasurementType: 'Voltage'

Add a digital channel with 'InputOnly'.

dich = addDigitalChannel(s,'dev1','Port0/Line0:1','InputOnly')
dich = 

Number of channels: 2
   index Type Device   Channel   MeasurementType Range Name
   ----- ---- ------ ----------- --------------- ----- ----
   1     dio  Dev1   port0/line0 InputOnly       n/a
   2     dio  Dev1   port0/line1 InputOnly       n/a

Change the TerminalConfig property of the input channel to 'SingleEnded'.

aich.TerminalConfig = 'SingleEnded';

You can use the channel object to access and edit the Channels property.

Was this topic helpful?