flushdata - Remove data from data acquisition engine

Syntax

flushdata(obj)
flushdata(obj,'mode')

Arguments

obj

An analog input object or array of analog input objects.

'mode'

Specifies how much data is removed from the engine.

Description

flushdata(obj) removes all data from the data acquisition engine and resets the SamplesAvailable property to zero.

flushdata(obj,'mode') removes data from the data acquisition engine depending on the value of mode:

Examples

Create the analog input object ai for a National Instruments® board and add hardware channels 0-7 to it.

ai = analoginput('nidaq','Dev1');
addchannel(ai,0:7);

A 2-second acquisition is configured and the device object is executed.

set(ai,'SampleRate',2000)
duration = 2;
ActualRate = get(ai,'SampleRate');
set(ai,'SamplesPerTrigger',ActualRate*duration)
start(ai)
wait(ai,duration+1)

Four thousand samples will be acquired for each channel group member. To extract 1000 samples from the data acquisition engine for each channel:

data = getdata(ai,1000);

You can use flushdata to remove the remaining 3000 samples from the data acquisition engine.

flushdata(ai)
ai.SamplesAvailable
ans =
     0

See Also

Functions

getdata

Properties

SamplesAvailable, SamplesPerTrigger, TriggerRepeat

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS