| Data Acquisition Toolbox | ![]() |
Extract data, time, and event information from the data acquisition engine
Syntax
data = getdata(obj)data = getdata(obj,samples)data = getdata(obj,'type')data = getdata(obj,samples,'type')[data,time] = getdata(...)[data,time,abstime] = getdata(...)[data,time,abstime,events] = getdata(...)
Arguments
Description
extracts the number of samples specified by the SamplesPerTrigger property for each channel contained by data = getdata(obj)
obj. data is an m-by-n array where m is the number of samples extracted and n is the number of channels.
extracts the number of samples specified by data = getdata(obj,samples)
samples for each channel contained by obj.
data = getdata(obj,'type') extracts data in the specified format. If type is specified as native, the data is returned in the native data format of the device. If type is specified as double (the default), the data is returned as doubles.
extracts the number of samples specified by data = getdata(obj,samples,'type')
samples in the format specified by type for each channel contained by obj.
returns data as sample-time pairs. [data,time] = getdata(...)
time is an m-by-1 array of relative time values where m is the number of samples returned. Relative time is measured with respect to the first sample logged by the engine.
extracts data as sample-time pairs and returns the absolute time of the trigger. The absolute time is returned as a [data,time,abstime] = getdata(...)
clock vector and is identical to the value stored by the InitialTriggerTime property.
extracts data as sample-time pairs, returns the absolute time of the trigger, and returns a structure containing a list of events that occurred up to the [data,time,abstime,events] = getdata(...)
getdata call. The possible events that can be returned are identical to those stored by the EventLog property.
Remarks
getdata returns all requested data and does not miss any samples. In the unlikely event that the engine cannot keep pace with the hardware device, it is possible that data is missed. If data is missed, the DataMissedFcn property is called and the device object is stopped.
getdata is a blocking function because it returns execution control to the MATLAB workspace only when the requested number of samples are extracted from the engine for each channel group member.
getdata is blocking. This will not stop the acquisition but will return control to MATLAB.
SamplesAvailable property.
More About Extracting Data From the Engine
SamplesAvailable property value is automatically reduced by the number of samples returned.
Timeout property.
getdata call, a NaN is inserted into the returned data and time arrays and the absolute time returned is given by the first trigger.
Example
Create the analog input object ai for a National Instruments board and add hardware channels 0-3 to it.
Configure a one second acquisition with SampleRate set to 1000 samples per second and SamplesPerTrigger set to 1000 samples per trigger.
The following getdata command blocks execution control until all sample-time pairs, the absolute time of the trigger, and any events that occurred during the getdata call are returned.
data is returned as a 1000-by-4 array of doubles, time is returned as a 1000-by-1 vector of relative times, abstime is returned as a clock vector, and events is returned as a 3-by-1 structure array.
The three events returned are the start event, the trigger event, and the stop event. To return specific event information about the stop event, you must access the Type and Data fields.
Functions
flushdata, getsample, peekdata
Properties
DataMissedFcn, EventLog, SamplesAvailable, SamplesPerTrigger, Timeout
| get | getsample | ![]() |