Documentation Center

  • Trial Software
  • Product Updates

NotifyWhenDataAvailableExceeds

Control firing of DataAvailable event

Description

When working with the session-based interface the DataAvailable event is fired when the scans available to the session object exceeds the value specified in the NotifyWhenDataAvailableExceeds property.

Values

By default the DataAvailable event fires when 1/10 second worth of data is available for analysis. To specify a different threshold change this property to control when DataAvailable fires.

Examples

Control Firing of Data Available Event

Add an event listener to display the total number of scans acquired and fire the event when the data available exceeds specified amount.

Create the session and add an analog input voltage channel.

s=daq.createSession('ni');
addAnalogInputChannel(s,'Dev4', 1, 'Voltage');
lh=addlistener(s,'DataAvailable', ...
			@(src, event) disp(s.ScansAcquired));

The default the Rate is 1000 scans per second. The session is automatically configured to fire the DataAvailable notification 10 times per second.

Increase the Rate to 800,000 scans per second and the DataAvailable notification automatically fires 10 times per second.

s.Rate=800000;
s.NotifyWhenDataAvailableExceeds
ans =
        80000

Running the acquisition causes the number of scans acquired to be displayed by the callback 10 times.

data=startForeground(s);
               80000

               160000

               240000

               320000

               400000

               480000

               560000

               640000

               720000

               800000

Increase NotifyWhenDataAvailableExceeds to 160,000. NotifyWhenDataAvailableExceeds is no longer configured automatically when the Rate changes.

s.NotifyWhenDataAvailableExceeds = 160000;
s.IsNotifyWhenDataAvailableExceedsAuto
ans =

     0

Start the acquisition. The DataAvailable event is fired only five times per second.

data=startForeground(s);
               160000

               320000

               480000

               640000

               800000

Set IsNotifyWhenDataAvailableExceedsAuto back to true.

s.IsNotifyWhenDataAvailableExceedsAuto=true;
s.NotifyWhenDataAvailableExceeds
ans =
                80000

This causes NotifyWhenDataAvailableExceeds to set automatically when Rate changes.

s.Rate = 50000;
s.NotifyWhenDataAvailableExceeds
ans =
                 5000
Was this topic helpful?