Specify duration of acquisition


When working with the session-based interface, use the DurationInSeconds property to change the duration of an acquisition.

When the session contains analog, digital, or audio output channels, DurationInSeconds is a read-only property whose value is determined by s.ScansQueueds.Rate.

If the session contains only counter output channels with PulseGeneration measurement type, then DurationInSeconds represents the duration of the pulse train signal generation.


In a session with only input channels or counter output channels, you can enter a value in seconds for the length of the acquisition. Changing the duration changes the number of scans accordingly. By default, DurationInSeconds is set to 1 second.


Create a session object, add an analog input channel, and change the duration:

s = daq.createSession('ni');
s.DurationInSeconds = 2
s = 

Data acquisition session using National Instruments hardware:
   Will run for 2 seconds (2000 scans) at 1000 scans/second.
   Operation starts immediately.
      Number of channels: 1
      index Type  Device   Channel  MeasurementType      Range        Name
      ----- ---- --------- ------- ----------------- ---------------- ----
      1     ai   cDAQ1Mod1 ai0       Voltage (Diff)  -10 to +10 Volts