Main Content

add

Add channel information to daqchannellist object table

Since R2024b

    Description

    daqchannellistObj = add(daqchannellistObj,direction,deviceID,channelID,measurementType) adds channel information to a channel list object specified by daqchannellistObj. The channel information must include signal direction, device ID, channel ID, and measurement type.

    daqchannellistObj = add(daqchannellistObj,direction,deviceID,channelID,measurementType,Name=Value) adds channel information with additional properties specified by one or more name-value arguments. For example, to configure a channel with differential terminal configuration, set TerminalConfig to Differential.

    Note

    • This function works for devices from National Instruments™ only.

    • Use this function to improve performance while adding large number of channels to the same DataAcquisition object.

    example

    Examples

    collapse all

    Create a daqchannellist object.

    channelList = daqchannellist;

    Add channels to the list.

    channelList = add(channelList,"input","Dev2","port0/line0:7","Digital"); 
    channelList = add(channelList,"input","PXI1Slot2","0:15","Voltage",TerminalConfig="PseudoDifferential",Range=[-10 10]);
    

    View the list of channels.

    channelList.Channels
    ans =
     
    2x6 table
    
    Direction        DevIDs       ChannelIDs      MeasurementType          TerminalConfig       Range   
    ________     ___________    __________       _______________       ____________________    ________   
     
     "input"       "Dev2"      "port0/line0:7"       "Digital"             <missing>          [NaN NaN]
     "input"     "PXI1Slot2"      "0:15"             "Voltage"          "PseudoDifferential"  [-10  10]

    Create a DataAcquisition interface object for a device and add the list of channels using the daqchannellist object.

    d = daq("ni",Channels=channelList);

    Input Arguments

    collapse all

    Channel list, specified as a daqchannellist object, which contains the list of channels as a table.

    Example: channelList

    Signal direction in channel, specified as input, output, or bidirectional.

    Example: "input"

    Data Types: char | string

    Device ID as defined by the device vendor, specified as a character vector or string. Obtain the device ID by calling daqlist.

    Example: "Dev1"

    Data Types: char | string

    Channel ID, specified as a character vector or string. The channel ID often indicates the physical location of the channel on the device. The values supported by the function are specific to the vendor and device. You can add multiple channels by specifying the channel ID as a vector (using : operator).

    Example: "port0/line0:7"

    Data Types: char | string

    Channel measurement type, specified as a character vector or string. measurementType represents a vendor-defined measurement type. This table lists the valid measurement types.

    Measurement TypeSubsystem

    'Voltage'

    Analog Input

    'Current'

    Analog Input

    'Thermocouple'

    Analog Input

    'Accelerometer'

    Analog Input

    'RTD'

    Analog Input

    'Bridge'

    Analog Input

    'Microphone'

    Analog Input

    'IEPE'

    Analog Input

    'Digital'

    Digital I/O

    'EdgeCount'

    Counter Input

    'Frequency'

    Counter Input

    'PulseWidth'

    Counter Input

    'Position'

    Counter Input

    'Audio'

    Audio Input

    Not all devices support all the measurement types.

    Example: "Voltage"

    Data Types: char | string

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: add(channelList,"PXI1Slot1","0:15","Voltage","input",TerminalConfig="Differential",Range=[-5 5]);

    Note

    If you do not specify any value for TerminalConfig and Range:

    • The function populates the columns in the table as <missing> and [NaN NaN].

    • The function considers the default channel properties when the channel list is used by a DataAcquisition object that you create by using the daq function.

    Channel terminal configuration, specified as one of these:

    • 'Differential'

    • 'SingleEnded'

    • 'SingleEndedNonReferenced'

    • 'PseudoDifferential'

    For more information, see Channel Configuration.

    Example: TerminalConfig="Differential"

    Data Types: char | string

    Input value range, specified as a vector of two double values indicating the minimum and maximum range.

    Example: Range=[-5 5]

    Data Types: double

    Version History

    Introduced in R2024b

    See Also

    Functions