Main Content

daq

Create DataAcquisition interface object for devices from specified vendor

Since R2020a

Description

d = daq(vendor) creates a DataAcquisition interface object for configuring and operating data acquisition devices from the vendor specified in vendor.

example

d = daq(vendor,Channels=daqchannellistObj) adds the National Instruments™ device channels specified in daqchannellistObj. Use the daqchannellistObj to improve performance when adding large number of channels to the same DataAcquisition object. (since R2024b)

example

Examples

collapse all

Create a DataAcquisition object for interfacing with Windows® sound devices.

d = daq("directsound")
d = 

DataAcquisition using DirectSound hardware:

                     Running: 0
                        Rate: 44100
           NumScansAvailable: 0
              NumScansQueued: 0
    NumScansOutputByHardware: 0
                   RateLimit: []

Show channels
Show properties and methods

Since R2024b

Create a daqchannellist object.

channelList = daqchannellist;

Add channel information to the object.

channelList = add(channelList,"input","Dev1","port0/line0:2","Digital");
channelList = add(channelList,"input","Dev3","0:2","Voltage");

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

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

DataAcquisition using National Instruments(TM) hardware:

                     Running: 0
                        Rate: 0
           NumScansAvailable: 0
            NumScansAcquired: 0
              NumScansQueued: 0
    NumScansOutputByHardware: 0
                   RateLimit: [0 0]

Show channels
Show properties and methods

View the list of channels.

d.Channels
ans = 

    Index    Type     Device       Channel       Measurement Type          Range                  Name       
    _____    _____    ______    _____________    ________________    __________________    __________________

      1      "dio"    "Dev1"    "port0/line0"    "InputOnly"         "n/a"                 "Dev1_port0/line0"
      2      "dio"    "Dev1"    "port0/line1"    "InputOnly"         "n/a"                 "Dev1_port0/line1"
      3      "dio"    "Dev1"    "port0/line2"    "InputOnly"         "n/a"                 "Dev1_port0/line2"
      4      "ai"     "Dev3"    "ai0"            "Voltage (Diff)"    "-10 to +10 Volts"    "Dev3_ai0"        
      5      "ai"     "Dev3"    "ai1"            "Voltage (Diff)"    "-10 to +10 Volts"    "Dev3_ai1"        
      6      "ai"     "Dev3"    "ai2"            "Voltage (Diff)"    "-10 to +10 Volts"    "Dev3_ai2" 

Input Arguments

collapse all

Device vendor, specified as one of these:

  • ni: National Instruments

  • adi: Analog Devices®

  • mcc: Measurement Computing™

  • directsound: Microsoft® DirectSound

  • digilent: Digilent®

Example: d = daq("ni")

Data Types: char | string

Since R2024b

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

Note

  • The channel list must include devices from National Instruments only.

  • Use the daqchannellist object to improve performance when adding large number of channels to the same DataAcquisition object.

Example: d = daq("ni",Channels=channelList)

Output Arguments

collapse all

Data acquisition interface, returned as a DataAcquisition object. This interface can accommodate all devices supported by the specified vendor. To create an interface with a device from a different vendor, create a separate DataAcquisition object.

Version History

Introduced in R2020a

expand all