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.

removeChannel

Remove channel from session object

Syntax

removeChannel(s,idx);

Description

example

removeChannel(s,idx); removes the channel specified by idx from the session object s.

Examples

collapse all

Start with a session s, to which you add two analog input and two analog output voltage channels and display the channel information.

s
s = 

Data acquisition session using National Instruments hardware:
   No data queued.  Will run at 1000 scans/second.
   Operation starts immediately.
      Number of channels: 4
      index Type  Device   Channel   MeasurementType      Range           Name
      ----- ---- --------- ------- -------------------   ---------------- ----
      1     ai   cDAQ1Mod4 ai0     Voltage (SingleEnd)   -10 to +10 Volts
      2     ai   cDAQ1Mod4 ai1     Voltage (SingleEnd)   -10 to +10 Volts
      3     ao   cDAQ1Mod2 ao0     Voltage (Diff)        -10 to +10 Volts
      4     ao   cDAQ1Mod2 ao1     Voltage (Diff)        -10 to +10 Volts

Remove channel 'ai0' with the index 1 from the session:

removeChannel(s,1)

To see how the indexes shift after you remove a channel, type:

s
s = 

Data acquisition session using National Instruments hardware:
   No data queued.  Will run at 1000 scans/second.
   All devices synchronized using cDAQ1 CompactDAQ chassis backplane. (Details)
      Number of channels: 3
      index Type  Device   Channel   MeasurementType     Range            Name
      ----- ---- --------- ------- -------------------   ---------------- ----
      1     ai   cDAQ1Mod4 ai1     Voltage (SingleEnd)   -10 to +10 Volts
      2     ao   cDAQ1Mod2 ao0     Voltage (Diff)        -10 to +10 Volts
      3     ao   cDAQ1Mod2 ao1     Voltage (Diff)        -10 to +10 Volts

Remove the first output channel 'ao0' at index 2:

removeChannel(s,2);

The session now displays one input and one output channel:

s.Channels
ans = 

Number of channels: 2
      index Type  Device   Channel   MeasurementType     Range            Name
      ----- ---- --------- ------- -------------------   ---------------- ----
      1     ai   cDAQ1Mod4 ai1     Voltage (SingleEnd)   -10 to +10 Volts
      2     ao   cDAQ1Mod2 ao1     Voltage (Diff)        -10 to +10 Volts

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.

Channel index, specified as a numeric value. Use the index of the channel that you wan to remove from the session.

Introduced in R2010b

Was this topic helpful?