Discover NI Devices
This example shows how to discover National Instruments™ devices visible to MATLAB® and get information about channel and measurement types available in those devices.
Display a List of Available Devices
Use daqlist
to display a list of devices available to your machine and MATLAB.
d = daqlist("ni")
d = 12×4 table DeviceID Description Model DeviceInfo ___________ __________________________________ _____________ ____________________ "cDAQ1Mod1" "National Instruments NI 9205" "NI 9205" [1×1 daq.DeviceInfo] "cDAQ1Mod2" "National Instruments NI 9263" "NI 9263" [1×1 daq.DeviceInfo] "cDAQ1Mod3" "National Instruments NI 9234" "NI 9234" [1×1 daq.DeviceInfo] "cDAQ1Mod4" "National Instruments NI 9201" "NI 9201" [1×1 daq.DeviceInfo] "cDAQ1Mod5" "National Instruments NI 9402" "NI 9402" [1×1 daq.DeviceInfo] "cDAQ1Mod6" "National Instruments NI 9213" "NI 9213" [1×1 daq.DeviceInfo] "cDAQ1Mod7" "National Instruments NI 9219" "NI 9219" [1×1 daq.DeviceInfo] "cDAQ1Mod8" "National Instruments NI 9265" "NI 9265" [1×1 daq.DeviceInfo] "Dev1" "National Instruments PCIe-6363" "PCIe-6363" [1×1 daq.DeviceInfo] "Dev2" "National Instruments NI ELVIS II" "NI ELVIS II" [1×1 daq.DeviceInfo] "Dev3" "National Instruments PCIe-6363" "PCIe-6363" [1×1 daq.DeviceInfo] "Dev4" "National Instruments PCIe-6363" "PCIe-6363" [1×1 daq.DeviceInfo]
Get Details About a Device
The daqlist
command shows you the overview of devices available. To obtain more information about a particular device, view the "DeviceInfo" table cell for it.
deviceInfo = d{1, "DeviceInfo"}
deviceInfo = ni: National Instruments NI 9205 (Device ID: 'cDAQ1Mod1') Analog input supports: 4 ranges supported Rates from 0.6 to 250000.0 scans/sec 32 channels ('ai0' - 'ai31') 'Voltage' measurement type This module is in slot 1 of the 'cDAQ-9178' chassis with the name 'cDAQ1'.
Dynamic Hardware Discovery
When the hardware configuration changes (for example, a new CompactDAQ module is plugged into the chassis), use daqreset
followed by daqlist
to observe the changes.