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 digital or audio output channels, DurationInSeconds becomes a read only property.

If the output channels are analog, digital or audio, the 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, the 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 InputType      Range       Name
      ----- ---- --------- ------- --------- ---------------- ----
      1     ai   cDAQ1Mod1 ai0     Diff      -10 to +10 Volts

See Also


NumberOfScans, Rate



Was this topic helpful?