Data Acquisition Toolbox | ![]() ![]() |
Preview most recent acquired data
Syntax
Arguments
obj |
An analog input object. |
samples |
The number of samples to preview for each channel contained by obj . |
data |
An m-by-n matrix where m is the number of samples and n is the number of channels. |
Description
returns the latest number of samples specified by data = peekdata(obj,samples)
samples
to data
.
More About Using peekdata
getdata
, peekdata
is a nonblocking function that immediately returns control to MATLAB. Because peekdata
does not block execution control, data might be missed or repeated.
peekdata
takes a "snapshot" of the most recent acquired data and does not remove samples from the data acquisition engine. Therefore, the SamplesAvailable
property value is not affected when peekdata
is called.
Rules for Using peekdata
peekdata
before a trigger executes. Therefore, peekdata
is useful for previewing data before it is logged to the engine or to a disk file.
peekdata
while the device object is running. However, you can call peekdata
once after the device object stops running.
samples
is greater than the number of samples currently acquired, all available samples are returned with a warning message stating that the requested number of samples were not available.
Example
Create the analog input object ai
for a National Instruments board, add eight input channels, and configure ai
for a two second acquisition.
ai = analoginput('nidaq',1); addchannel(ai,0:7); set(ai,'SampleRate',2000) set(ai,'SamplesPerTrigger',4000)
After issuing the start
function, you can preview the data.
peekdata
returns 100 samples to data
for all eight channel group members. If 100 samples are not available, then whatever samples are available will be returned and a warning message is issued. The data is not removed from the data acquisition engine.
Functions
Properties
![]() | obj2mfile | propinfo | ![]() |