removeChannel
(Not recommended) Remove channel from session object
This session
object function is not recommended. Use DataAcquisition
object functions instead. See Version History.
Syntax
Description
Examples
Remove Channels from a Session
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 indices 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
s
— Data acquisition session
session object
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.
idx
— Index of channel
numeric
Channel index, specified as a numeric value. Use the index of the channel that you want to remove from the session.
Version History
Introduced in R2010bR2020a: session
object interface is not recommended
Use of this function with a session
object is not recommended. To
access a data acquisition device, use a DataAcquisition
object
with its functions and properties instead.
For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)