| Data Acquisition Toolbox | Search  Help Desk |
Extracting Stored Data
After the trigger occurs, acquired data fills the memory allocated by the engine. Once the memory is filled, the data is overwritten. To prevent data from being overwritten, it must be extracted from the engine in a timely way. After the data is extracted, it can be processed in the MATLAB environment. If you want to guarantee that all data samples are acquired and processed without gaps, then thegetdata function must be used. For example, to extract the first 100 samples for each channel group member
data = getdata(ai, 100);
Data is an m-by-n array where m is the number of samples requested and n is the number of channels. getdata will not return execution control to MATLAB until the requested samples are acquired and returned to data. If the number of samples is not specified, then getdata defaults to the number specified in the SamplesPerTrigger property.
You can also return sample-time pairs with getdata.
[data, time] = getdata(ai, 100);
time is an m-by-1 array containing relative time values for all m samples. Time is measured relative to the time the first sample logged by the engine. Time is measured continuously until the acquisition is stopped.