Acquire Data with Analog Input Recorder
This topic shows how to use the Analog Input Recorder app to view and record data from an NI USB-6211 device.
To open the Analog Input Recorder app, on the MATLAB® Toolstrip, on the Apps tab, in the Test and Measurement section, click Analog Input Recorder.
Once you open the app, Analog Input Recorder attempts to find all your attached analog and audio input devices.
Note
Opening Analog Input Recorder deletes all your existing
DataAcquisition
interfaces in MATLAB.
You cannot access the DataAcquisition
interface created by
Analog Input Recorder from the MATLAB command line.
If you plug in a device when the app is open, you must refresh the devices list to access that device. On the Devices tab, click Refresh. Use the same procedure to remove a device from the list after unplugging it.
Select a device from the Device List. The app immediately provides a preview of the analog input signal using default settings.
Configure Channel
You can modify the scan or channel settings. This image shows the app displaying two channels for the selected device. Notice that the value of the Max Rate parameter decreases when you increase the number of channels. The rate of decrease depends on the selected device.
Record Session
Set the values of the Number of Scans, Duration, and Rate parameters.
Select the Continuous parameter if you want to override the duration or number of scans. In this mode, the app continues to record until you explicitly stop it.
When you are ready to start recording data, click Record.
When recording is complete, either because the specified number of scans have been
recorded or you click Stop, the app assigns the recorded data to
the specified Workspace Variable. By default, the variable name
starts with Device ID_1
, and is incremented with every recording. You
can also specify any valid MATLAB variable name that is not already in use. The app assigns the variable an
M-by-N timetable, where
M is number of rows in the table and represents the number of
scans and N is number of columns in the table and represents the
number of channels.
Use this command to view the file information regarding the acquired timetable for a multiple channel recording.
whos
Name Size Bytes Class Attributes Dev3_1 10000x2 241671 timetable
Use this command to view the first four rows of the timetable.
Dev3_1(1:4,:)
ans = 4×2 timetable Time Dev3_ai0 Dev3_ai1 __________ ________ ________ 0 sec -4.3578 -7.6676 0.0001 sec -4.2872 -7.6052 0.0002 sec -4.2136 -7.5304 0.0003 sec -4.1874 -7.4632
The timestamp elements of the table are relative to the first scan. The absolute time
of the first scan is available in the timetable in the TriggerTime
custom property. Use this command to retrieve the absolute time of the first
scan.
Dev3_1.Properties.CustomProperties.TriggerTime
datetime 19-Apr-2024 15:21:01.239
Analyze Data
In the Analog Input Recorder app, click Signal Analyzer to launch the Signal Analyzer app and display the recorded data. This image shows an analysis of signal statistics and peaks for the recorded data. For more information, see Use Signal Analyzer App (Signal Processing Toolbox).
Note
You need a license for Signal Processing Toolbox™ to use this feature.
You can record data for predictive maintenance analysis using the Analog Input Recorder app. To analyze the features and identify condition indicators for machine diagnostics, click Diagnostic Feature Designer. This action launches a new session of the Diagnostic Feature Designer app with access to the recorded data. To import the recorded data as signals, select the Use as Signal parameter in the New Session dialog box. For more information, see Diagnostic Feature Designer (Predictive Maintenance Toolbox).
Note
You need a license for Predictive Maintenance Toolbox™ to use this feature.
Generate Code
In the Analog Input Recorder app, click Generate Script on the app toolstrip to open MATLAB Editor and display the equivalent code for recording data. The following code is generated for a finite (non-continuous) two-channel recording from the device used in this example.