acquire data with analog input recorder -凯发k8网页登录

main content

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, on the matlab® toolstrip, on the apps tab, in the test and measurement section, click analog input recorder.

analog input recorder button

upon opening, the analog input recorder attempts to find all your attached analog and audio input devices.

note

opening the analog input recorder deletes all your existing dataacquisition interfaces in matlab.

the dataacquisition interface created by the analog input recorder is not accessible from the matlab command line.

if you plug in a device while the app is open, you must refresh the listing for access to that device. on the devices tab, click refresh. use the same procedure to remove a device from the listing after unplugging it.

select the device you want to use in the device list. the app immediately starts a preview of the analog input using default settings.

analog input recorder app

modify any scan and channel settings for your specific needs. the following image shows the app displaying three channels of the device. notice that the max rate value has changed with the number of channels; this relationship depends on the device.

analog input recorder app with three channels

set values for number of scans or duration, and rate.

check continuous if you want to override the duration or number of scans. in this mode, recording continues 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 is recorded or you click stop, the recorded data is assigned to the indicated matlab workspace variable. by default, the variable starts as daq_1, and its name is incremented with every recording, but you can specify any valid matlab variable name not already in use. the variable is assigned an m-by-n timetable, where m table rows is the number of scans and n columns is the number of channels.

the following commands show the beginning of the acquired timetable for a multiple channel recording.

whos
  name          size            bytes  class        attributes
  daq_1      1000x3             33315  timetable

view the first four rows of the timetable.

daq_1(1:4,:)
ans =
  4×3 timetable
      time       dev1_ai0    dev1_ai1    dev1_ai2
    _________    ________    ________    ________
    0 sec          4.0578    -1.9676      5.1516 
    0.001 sec      2.8081    -2.5671      4.3738 
    0.002 sec      1.4604    -3.0992      3.4339 
    0.003 sec    0.029896    -3.5211      2.3651 

the timestamp elements of the table are relative to the first scan. the absolute time of the first scan is available in the timetable triggertime custom property. for example,

daq_1.properties.customproperties.triggertime
  datetime
   19-nov-2019 15:21:01.239

in the analog input recorder, click generate script for the app to open the matlab editor and display the equivalent code for recording data. the following code is generated for the finite (non-continuous) 3-channel recording of this example.

analog input recorder generated code

see also

apps

related topics

网站地图