DataAcquisition
Description
The DataAcquisition
object provides access to the devices of a
specified vendor.
Creation
Use the daq
function to
create a DataAcquisition
object.
Properties
AutoSyncDSA
— Automatically Synchronize DSA devices
false (default) | true
Automatically Synchronize DSA devices, specified as a logical
true
or false
. Use this property to enable or
disable automatic synchronization between DSA (PXI or PCI) devices in the same
DataAcquisition. By default automatic synchronization capability is disabled.
Example:
true
Data Types: logical
Channels
— Device channels
array of channel objects
This property is read-only.
Device channels, returned as an array of channel objects. Create channels with the
functions addinput
, addoutput
, and
addbidirectional
.
Example: addinput(d,…)
Clocks
— Device clock connections
array of clock
objects
This property is read-only.
Device clock connections, returned as an array of clock objects. Create clocks with
the addclock
function.
Example:
addclock(d,…)
DigitalTriggers
— Device digital trigger connections
array of DigitalTrigger
objects
This property is read-only.
Device digital trigger connections, returned as an array of
DigitalTrigger
objects. Use the addtigger
function to add digital triggers to the DataAcquisition.
Example: addtrigger(d,…)
DigitalTriggerTimeout
— Time allowed for occurrence of digital trigger
10 (default) | numeric | duration
Time allowed for occurrence of digital trigger, specified as a numeric value in seconds or a duration.
Example: 30
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| duration
ErrorOccurredFcn
— Callback function to call when error occurs
function handle
Callback function to call when error occurs, specified as a function handle.
Example: @mycleanup
Data Types: function_handle
LogToDisk
— Specify TDMS file logging
false
(default) | true
Control whether to log data to TDMS file, specified as true
or
false
(default).
Example:
dq.LogToDisk = true
Data Types: logical
LogFileMode
— Write mode for logging to TDMS file
"append"
(default) | "overwrite"
| "new"
Write mode for logging to TDMS file, specified as a string or character vector. The following values are supported:
"append"
— Append data to existing file. Old data is retained; new data comes after old data in a new channel group."overwrite"
— Overwrite existing file with new data. Old data is lost."new"
— Create a new file. If the file already exists, an error occurs.
Example:
dq.LogFileMode = "overwrite"
Data Types: char
| string
LogFileName
— Name of TDMS file for logging data
string | char
Name of TDMS file to log data to, specified as a string or character vector. The
default file name is of the format "recording_YYYYMMDD-HHMMSS.tdms"
.
Example:
dq.LogFileName = "MyDataFile_2.tdms"
Data Types: char
| string
NumDigitalTriggersRemaining
— Number of digital triggers remaining in run
1 (default) | numeric
This property is read-only.
Number of digital triggers remaining in run, returned as a double.
Example: 1
Data Types: double
NumDigitalTriggersPerRun
— Number of digital triggers per DataAcquisition run
numeric
Number of digital triggers per DataAcquisition run, returned as a double.
Example: 2
Data Types: double
NumScansAcquired
— Number of data scans acquired since the last start
numeric
This property is read-only.
Number of data scans acquired in background operation since the last
start
, returned as a uint64 value. This value is reset each time
start
is
called, and does not reflect whether the scans have been read into MATLAB.
Example: 1000
Data Types: uint64
NumScansAvailable
— Number of data scans acquired and available for reading
numeric
This property is read-only.
Number of data scans available for reading, returned as a uint64 value. These scans
have been acquired by the device input channels in a background operation, but have not
yet been read into MATLAB. The value decreases with each call to read
; and is
reset by a call to start
.
Example: 1000
Data Types: uint64
NumScansOutputByHardware
— Number of scans generated as device output
numeric
This property is read-only.
Number of scans generated as device output, returned as a uint64 value.
Example: 1024
Data Types: uint64
NumScansQueued
— Number of scans prepared for device output
numeric
This property is read-only.
Number of scans queued to the device output channels, returned as a uint64 value.
Example: 4000
Data Types: uint64
Rate
— Data scan rate
numeric
Data scan rate, specified as a numeric value of samples per second.
Example: 44100
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
RateLimit
— Lower and upper scan rate limits
array of doubles
This property is read-only.
Lower and upper scan rate limits, returned as a 1-by-2 vector of doubles indicating minimum and maximum allowed scan rates in samples per second. The scan rate limits depend on the hardware and its configurations. In devices that multiplex channels to a converter, the rate limit is impacted by the number of channels you use. For more information, see Sampling.
Example:
[8000 192000]
Data Types: double
Running
— DataAcquisition running indication
true | false
This property is read-only.
DataAcquisition running indication, returned as true or false.
Example: true
Data Types: logical
ScansAvailableFcn
— Callback function when scans are available
function handle
Callback function to execute when scans are available from the input channels, specified as a function handle
Example: @read
Data Types: function_handle
ScansAvailableFcnCount
— Number of acquired scans to trigger ScansAvailableFcn
numeric
Number of acquired scans to trigger ScansAvailableFcn
, specified
as a numeric value. The function handle specified in
ScansAvailableFcn
executes every time
ScansAvailableFcnCount
scans are acquired from the input
channels.
Example: 8000
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
ScansRequiredFcn
— Callback function when output scan data is required
function handle
Callback function to execute when scan data is required for device output channels, specified as a function handle.
Example: @write
Data Types: function_handle
ScansRequiredFcnCount
— Number of scans to trigger ScansRequiredFcn
"auto"
(default) | numeric
Number of queued scans to trigger ScansRequiredFcn
, specified as
a numeric value or "auto"
. The function handle specified in
ScansRequiredFcn
executes when
NumScansQueued
drops below the value specified in this property.
If this is set to "auto"
, the value resets to a default.
Example: 2000
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| string
UserData
— Custom data
any data
Custom data, specified as any MATLAB® data type and format.
Example: datetime('now')
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| char
| string
| struct
| table
| cell
| function_handle
| categorical
| datetime
| duration
| calendarDuration
| fi
Vendor
— Data acquisition hardware vendor information
vendor object
This property is read-only.
Data acquisition hardware vendor information, returned as a vendor object with the following properties:
ID FullName AdaptorVersion DriverVersion IsOperational
This object is the same as the corresponding vendor object returned by the
daqvendorlist
function.
WaitingForDigitalTrigger
— Digital trigger waiting indication
false (default) | true
This property is read-only.
Digital trigger waiting indication, returned as a logical.
Example:
true
Data Types: logical
Object Functions
addinput | Add input channel to device interface |
read | Read data acquired by hardware |
readwrite | Simultaneously read and write device channel data |
start | Start DataAcquisition background operation |
stop | Stop background operation |
removechannel | Remove channel from device interface |
flush | Flush DataAcquisition input and output buffers |
write | Write output scans to hardware channels |
preload | Queue scan data for device output |
addoutput | Add output channel to device interface |
addbidirectional | Add digital bidirectional channel to device interface |
resetcounters | Reset hardware scan count for all counter inputs |
addclock | Add clock connection to device interface |
removeclock | Remove clock from device interface |
addtrigger | Add trigger connection to device interface |
removetrigger | Remove trigger from device interface |
Examples
Create a DataAcquisition
Create and configure a DataAcquisition
object for
interfacing with National Instruments™ devices.
d = daq("ni")
d.Rate = 20000;
Version History
Introduced in R2020a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)