daq.Session Properties
Session object properties
Alphabetical listing of session object properties. Sessions for some vendors might not have all properties.
Session Properties
AutoSyncDSA
— Automatically Synchronize DSA devices
false
(default) | true
Automatically Synchronize DSA devices, specified as a logical
true
or false
. Use this property
to enable or disable automatic synchronization between DSA (PXI or PCI)
devices in the same DataAcquisition. By default automatic synchronization
capability is disabled.
To enable automatic synchronization, create a session and add channels from a DSA device:
s = daq.createSession('ni') addAnalogInputChannel(s,'PXI1Slot2',0,'Voltage'); addAnalogInputChannel(s,'PXI1Slot3',1,'Voltage');
Enable automatic synchronization and acquire data.
s.AutoSyncDSA = true; startForeground(s);
Example:
true
Data Types: logical
BitsPerSample
— Sampling resolution
numeric
This property is read-only.
Sampling resolution indicating the maximum value of bits per sample of the
device, based on the device specifications. By default this read-only value
is 24
.
Example: View BitsPerSample Property
Create an audio input session and display the session properties.
s = daq.createSession('directsound')
s = Data acquisition session using DirectSound hardware: Will run for 1 second (44100 scans) at 44100 scans/second. No channels have been added. Properties, Methods, Events
Click on the Properties link.
UseStandardSampleRates: true BitsPerSample: 24 StandardSampleRates: [1x15 double] NumberOfScans: 44100 DurationInSeconds: 1 Rate: 44100 IsContinuous: false NotifyWhenDataAvailableExceeds: 4410 IsNotifyWhenDataAvailableExceedsAuto: true NotifyWhenScansQueuedBelow: 22050 IsNotifyWhenScansQueuedBelowAuto: true ExternalTriggerTimeout: 10 TriggersPerRun: 1 Vendor: DirectSound Channels: '' Connections: '' IsRunning: false IsLogging: false IsDone: false IsWaitingForExternalTrigger: false TriggersRemaining: 1 RateLimit: '' ScansQueued: 0 ScansOutputByHardware: 0 ScansAcquired: 0
Channels
— Device channels
array of channel objects
This property is read-only.
Device channels, returned as an array of channel objects.
Tip
You cannot directly add or remove channels using the
Channels
propert. Use addAnalogInputChannel
and
addAnalogOutputChannel
to
add channels. Use removeChannel
to remove
channels.
Connections
— Device connections
array of clock and trigger connection objects
This property is read-only.
Device clock and trigger connections, returned as an array of objects.
This session property contains and displays all connections added to the session.
Tip
You cannot directly add or remove connections using the
Connections
property. Use addTriggerConnection
and
addClockConnection
to add
connections. Use removeConnection
to remove
connections.
Example: Remove Synchronization Connection
This example shows you how to remove a synchronization connection.
Create a session and add analog input channels, and trigger and clock connections.
s = daq.createSession('ni') addAnalogInputChannel(s,'Dev1', 0, 'voltage'); addAnalogInputChannel(s,'Dev2', 0, 'voltage'); addAnalogInputChannel(s,'Dev3', 0, 'voltage'); addTriggerConnection(s,'Dev1/PFI4','Dev2/PFI0','StartTrigger'); addTriggerConnection(s,'Dev1/PFI4','Dev3/PFI0','StartTrigger'); addClockConnection(s,'Dev1/PFI5','Dev2/PFI1','ScanClock');
Examine the session Connections
property.
s.Connections
ans = Start Trigger is provided by 'Dev1' at 'PFI4' and will be received by: 'Dev2' at terminal 'PFI0' 'Dev3' at terminal 'PFI0' Scan Clock is provided by 'Dev1' at 'PFI5' and will be received by: 'Dev2' at terminal 'PFI1' 'Dev3' at terminal 'PFI1' index Type Source Destination ----- ------------ --------- ----------- 1 StartTrigger Dev1/PFI4 Dev2/PFI0 2 StartTrigger Dev1/PFI4 Dev3/PFI0 3 ScanClock Dev1/PFI5 Dev2/PFI1 4 ScanClock Dev1/PFI5 Dev3/PFI1
Remove the last clock connection at index 4 and display the session connections.
removeConnection(s,4) s.Connections
ans = Start Trigger is provided by 'Dev1' at 'PFI4' and will be received by: 'Dev2' at terminal 'PFI0' 'Dev3' at terminal 'PFI0' Scan Clock is provided by 'Dev1' at 'PFI5' and will be received by 'Dev2' at terminal 'PFI1'. index Type Source Destination ----- ------------ --------- ----------- 1 StartTrigger Dev1/PFI4 Dev2/PFI0 2 StartTrigger Dev1/PFI4 Dev3/PFI0 3 ScanClock Dev1/PFI5 Dev2/PFI1
DurationInSeconds
— Specify duration of acquisition
1 (default) | numeric
Duration of an acquisition, specified in seconds. 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.
When the session contains analog, digital, or audio output channels,
DurationInSeconds
is a read-only property whose
value is determined
by
s.ScansQueued / s.Rate
If the session contains only counter output channels with
PulseGeneration
measurement type, then
DurationInSeconds
represents the duration of the
pulse train signal generation.
Example: Create a session object, add an analog input channel, and change the session duration:
s = daq.createSession('ni'); addAnalogInputChannel(s,'cDAQ1Mod1','ai0','voltage'); 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
Data Types: double
ExternalTriggerTimeout
— Specify maximum wait time for external trigger
numeric
Maximum amount of time in seconds the session waits for an external
trigger before timing out. To disable the timeout, set
ExternalTriggerTimeout
to a value of
Inf
.
Example: Specify External Trigger Timeout
Specify how long the session waits for an external trigger before timing out.
Create a session and click on the Properties
link to
display session properties.
s = daq.createSession('ni')
s = Data acquisition session using National Instruments hardware: Will run for 1 second (1000 scans) at 1000 scans/second. No channels have been added. Properties, Methods, Events AutoSyncDSA: false NumberOfScans: 1000 DurationInSeconds: 1 Rate: 1000 IsContinuous: false NotifyWhenDataAvailableExceeds: 100 IsNotifyWhenDataAvailableExceedsAuto: true NotifyWhenScansQueuedBelow: 500 IsNotifyWhenScansQueuedBelowAuto: true ExternalTriggerTimeout: 10 TriggersPerRun: 1 Vendor: National Instruments Channels: '' Connections: '' IsRunning: false IsLogging: false IsDone: false IsWaitingForExternalTrigger: false TriggersRemaining: 1 RateLimit: '' ScansQueued: 0 ScansOutputByHardware: 0 ScansAcquired: 0
Change the timeout to 15 seconds.
s.ExternalTriggerTimeout = 15;
Example: Specify External Trigger with Disabled Timeout
Set an external trigger on a session, without a timeout.
Create a session with an external trigger, then set its
ExternalTriggerTimeout
to
Inf
.
s = daq.createSession('ni'); addAnalogInputChannel(s,'Dev1','ai0','Voltage'); addTriggerConnection(s,'External','Dev1/PFI0','StartTrigger'); s.ExternalTriggerTimeout = Inf;
Data Types: double
IsContinuous
— Specify operation to continue until manually stopped
false
(default) | true
Use IsContinuous
to specify that the session
operation runs until you execute stop
. When set to
true
, the session will run continuously, acquiring or
generating data until stopped.
Set
IsContinuous
tofalse
to make the session operation stop automatically. This property is set tofalse
by default.Set
IsContinuous
totrue
to make the session operation run until you executestop
.
Example: Create a session object, add an analog input channel, and set the session to run until manually stopped:
s = daq.createSession('ni'); addAnalogInputChannel(s,'cDAQ1Mod1','ai0','voltage'); s.IsContinuous = true
s = Data acquisition session using National Instruments hardware: Will run continuously at 1000 scans/second until stopped. Operation starts immediately. Number of channels: 1 index Type Device Channel MeasurementType Range Name ----- ---- --------- ------- ----------------- ---------------- ---- 1 ai cDAQ1Mod1 ai0 Voltage (Diff) -10 to +10 Volts
Data Types: logical
IsDone
— Indicate if session operation is complete
true
| false
This property is read-only.
Indication that the session operation is complete, returned as
true
or false
.
Value is logical
1
(true
) when the session operation is complete.Value is logical
0
(false
) while the session operation is not complete.
Tip
IsRunning
indicates the session has started, but the hardware might not be acquiring or generating data. It is still true while the hardware is waiting for a trigger, and while transferring data in the process of stopping.IsLogging
indicates the hardware is actively acquiring or generating data.IsDone
indicates the session object has completed its operation, including all necessary transfer of data.
Example: Create an acquisition session and see if the operation is complete.
s = daq.createSession('ni'); addAnalogOutputChannel(s,'cDAQ1Mod2', 'ao1', 'vVoltage'); s.queueOutputData(linspace(-1, 1, 1000)'); s.startBackground(); s.IsDone
ans = 0
Issue a wait and see if the operation is complete.
wait(s) s.IsDone
ans = 1
Data Types: logical
IsLogging
— Indicate if hardware is acquiring or generating data
true
| false
This property is read-only.
Indication if the hardware is actively acquiring or generating data,
returned as true
or false
.
Value is logical
1
(true
) if the device is acquiring or generating data.Value is logical
0
(false
) if the device is not acquiring or generating data.
Tip
IsRunning
indicates the session has started, but the hardware might not be acquiring or generating data. It is still true while the hardware is waiting for a trigger, and while transferring data in the process of stopping.IsLogging
indicates the hardware is actively acquiring or generating data.IsDone
indicates the session object has completed its operation, including all necessary transfer of data.
Example: Check device logging.
Create and start a session.
ans = 1
The session is running, so check for device logging.
s.IsLogging
ans = 0
This result might indicate that the device is waiting for an external trigger. After triggering, wait until logging is complete.
wait(s) s.IsDone
ans = 1
Data Types: logical
IsNotifyWhenDataAvailableExceedsAuto
— Control if NotifyWhenDataAvailableExceeds
is set automatically
true
(default) | false
Indication if the NotifyWhenDataAvailableExceeds property is set automatically, or you have set a specific value.
Tip
This property is typically used to set NotifyWhenDataAvailableExceeds back to its default behavior.
When the value is
true
(default), then the NotifyWhenDataAvailableExceeds property is set automatically.When the value is
false
, you set the NotifyWhenDataAvailableExceeds property to a specific value.
Example: Enable Data Exceeds Notification
Change the IsNotifyWhenDataAvailableExceedsAuto
to be
able to set the NotifyWhenDataAvailableExceeds
property
to a specific value.
Create a session and display the properties by clicking the
Properties
link.
s = daq.createSession('ni')
s = Data acquisition session using National Instruments hardware: Will run for 1 second (1000 scans) at 1000 scans/second. No channels have been added. Properties, Methods, Events AutoSyncDSA: false NumberOfScans: 1000 DurationInSeconds: 1 Rate: 1000 IsContinuous: false NotifyWhenDataAvailableExceeds: 100 IsNotifyWhenDataAvailableExceedsAuto: true NotifyWhenScansQueuedBelow: 500 IsNotifyWhenScansQueuedBelowAuto: true ExternalTriggerTimeout: 10 TriggersPerRun: 1 Vendor: National Instruments Channels: '' Connections: '' IsRunning: false IsLogging: false IsDone: false IsWaitingForExternalTrigger: false TriggersRemaining: 1 RateLimit: '' ScansQueued: 0 ScansOutputByHardware: 0 ScansAcquired: 0
Change the IsNotifyWhenDataAvailableExceedsAuto
to
false
.
s.IsNotifyWhenDataAvailableExceedsAuto = false
s = Data acquisition session using National Instruments hardware: Will run for 1 second (1000 scans) at 1000 scans/second. No channels have been added.
Data Types: logical
IsNotifyWhenScansQueuedBelowAuto
— Control if NotifyWhenScansQueuedBelow
is set automatically
true
(default) | false
Indication if the NotifyWhenScansQueuedBelow property is set automatically, or you have set a specific value.
When the value is
true
, then NotifyWhenScansQueuedBelow is set automatically.When the value is
false
, you set NotifyWhenScansQueuedBelow to a specific value.
Example: Enable Notification When Scans Reach Below Specified Range
Change the
IsNotifyWhenScansQueuedBelowAuto
to be able to set
the NotifyWhenScansQueuedBelow
property to a specific
value.
Create a session and display the properties by clicking the
Properties
link.
s = daq.createSession('ni')
s = Data acquisition session using National Instruments hardware: Will run for 1 second (1000 scans) at 1000 scans/second. No channels have been added. Properties, Methods, Events AutoSyncDSA: false NumberOfScans: 1000 DurationInSeconds: 1 Rate: 1000 IsContinuous: false NotifyWhenDataAvailableExceeds: 100 IsNotifyWhenDataAvailableExceedsAuto: true NotifyWhenScansQueuedBelow: 500 IsNotifyWhenScansQueuedBelowAuto: true ExternalTriggerTimeout: 10 TriggersPerRun: 1 Vendor: National Instruments Channels: '' Connections: '' IsRunning: false IsLogging: false IsDone: false IsWaitingForExternalTrigger: false TriggersRemaining: 1 RateLimit: '' ScansQueued: 0 ScansOutputByHardware: 0 ScansAcquired: 0
Change the IsNotifyWhenDataAvailableExceedsAuto
to
false
.
s.IsNotifyWhenScansQueuedBelowAuto = false
s = Data acquisition session using National Instruments hardware: Will run for 1 second (1000 scans) at 1000 scans/second. No channels have been added.
Data Types: logical
IsRunning
— Indicate if session operation is in progress
true
| false
This property is read-only.
Session running indication, returned as true
or
false
.
The read-only IsRunning
property indicates the
session operation is started and in progress, whether or not the hardware is
acquiring or generating data at the time.
Tip
IsRunning
indicates the session has started, but the hardware might not be acquiring or generating data. It is still true while the hardware is waiting for a trigger, and while transferring data in the process of stopping.IsLogging
indicates the hardware is actively acquiring or generating data.IsDone
indicates the session object has completed its operation, including all necessary transfer of data.
Example: Create an acquisition session,
add a DataAvailable
event listener and start the
acquisition.
s = daq.createSession('ni'); addAnalogInputChannel(s,'cDAQ1Mod1','ai0','voltage'); lh = s.addlistener('DataAvailable', @plotData); function plotData(src,event) plot(event.TimeStamps, event.Data) end startBackground(s);
See if the session is in progress.
s.IsRunning
ans = 1
Wait until operation completes, and see if the session is in progress.
wait(s) s.IsRunning
ans = 0
Data Types: logical
IsWaitingForExternalTrigger
— Indicates if synchronization is waiting for an external trigger
false (default) | true
This property is read-only.
Indication if the acquisition or generation session is waiting for a
trigger from an external device. If you have added an external trigger, this
property displays true
, if not, it displays
false
.
Example:
true
Data Types: logical
NotifyWhenDataAvailableExceeds
— Specify number of acquired scans to fire DataAvailable
event
numeric
The DataAvailable
event is triggered
when the number of scans available to the session object exceeds the
quantity specified in the
NotifyWhenDataAvailableExceeds
property.
By default the DataAvailable
event triggers
when 1/10 second worth of data is available for analysis. To specify a
different threshold, change the value of
NotifyWhenDataAvailableExceeds
.
You cannot set the NotifyWhenDataAvailableExceeds
property when the session is in the prepared state, which can happen after
running startForeground
. In this case, call release
on the session before
setting this property value.
Example: 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 a 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 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, while 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
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
NotifyWhenScansQueuedBelow
— Specify number of queued scans to fire DataRequired
event
numeric
When generating output signals continuously, the
DataRequired
event is fired when you need to queue
more data. This occurs when the ScansQueued property drops
below the value specified in the
NotifyWhenScansQueuedBelow
property.
By default the DataRequired
event fires when
1/2 second worth of data remains in the queue. To specify a different
threshold, change this property value to control when the event is
fired.
Example: Control When DataRequired Event Is Fired
Specify a threshold below which the DataRequired
event fires.
Create a session and add an analog output channel.
s = daq.createSession('ni') addAnalogOutputChannel(s,'cDAQ1Mod2', 0, 'Voltage')
Queue some output data.
outputData = (linspace(-1,1,1000))'; s.queueOutputData(outputData);
Set the threshold of scans queued to 100
.
s.NotifyWhenScansQueuedBelow = 100;
Add an anonymous listener and generate the signal in the background:
lh = s.addlistener('DataRequired', ... @(src,event) src.queueOutputData(outputData)); startBackground(s);
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
NumberOfScans
— Number of scans for operation when starting
numeric
Use the NumberOfScans
property to specify the number
of scans the session will acquire during the operation. Changing the number
of scans changes the duration of an acquisition. When the session contains
output channels, NumberOfScans
becomes a read-only
property and the number of scans in a session is determined by the amount of
data queued.
Tips
To specify a time length for the acquisition, use DurationInSeconds.
To control the length of an output operation, use
queueOutputData
.
Example: Change Number of Scans
Create an acquisition session, add an analog input channel, and display
the NumberOfScans
.
s = daq.createSession('ni'); addAnalogInputChannel(s,'cDAQ1Mod1','ai0','Voltage'); s.NumberOfScans
ans = 1000
Change the NumberOfScans
property.
s.NumberOfScans = 2000
s = Data acquisition session using National Instruments hardware: Will run for 2000 scans (2 seconds) 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
Rate
— Data scan rate
numeric
Data scan rate, specified as a numeric value of samples per second. You can set the rate to any positive nonzero scalar value supported by the hardware in its current configuration. Many hardware devices accept fractional rates.
Tip
On most devices, the hardware limits the exact rates that you can set. When you set the rate, Data Acquisition Toolbox™ sets the rate to the next higher rate supported by the hardware. If the exact rate affects your analysis of the acquired data, obtain the actual rate after you set it, and then use that in your analysis.
Example: Set the Session Rate
Create a session and add an analog input channel.
s = daq.createSession('ni'); addAnalogInputChannel(s,'cDAQ1Mod1','ai1','Voltage');
Change the rate to 10000 scans per second.
s.Rate = 10000
s = Data acquisition session using National Instruments hardware: Will run for 1 second (10000 scans) at 10000 scans/second. Operation starts immediately. Number of channels: 1 index Type Device Channel MeasurementType Range Name ----- ---- --------- ------- ----------------- ---------------- ---- 1 ai cDAQ1Mod1 ai1 Voltage (Diff) -10 to +10 Volts
Data Types: double
RateLimit
— Lower and upper scan rate limits
array of doubles
This property is read-only.
Lower and upper scan rate limits, returned as a 1-by-2 vector of doubles indicating minimum and maximum allowed scan rates in samples per second. The scan rate limits depend on the hardware and its configurations. In devices that multiplex channels to a converter, the rate limit is impacted by the number of channels you use.
RateLimit
changes dynamically as the session
configuration changes.
Example: Find the Session Rate Limits
Create a session and add an analog input channel.
s = daq.createSession('ni'); addAnalogInputChannel(s,'cDAQ1Mod1','ai1','Voltage');
Examine the session rate limits.
format("longG")
s.RateLimit
ans = 0.1 250000
Data Types: double
ScansAcquired
— Number of data scans acquired during operation
numeric
This property is read-only.
Number of scans acquired after you start the operation calling startBackground
. This value is
reset each time you call startBackground
.
Example: Display Number of Acquired Scans
Acquire analog input data and display the number of scans acquired.
Create a session, add an analog input channel,
s = daq.createSession('ni'); ch = addAnalogInputChannel(s,'Dev1','ai1','voltage');
See how many scans the session had acquired before and after running.
s.ScansAcquired
ans = 0
startForeground(s); s.ScansAcquired
ans = 1000
ScansOutputByHardware
— Number of scans generated as device output
numeric
This property is read-only.
Number of scans output by the hardware after you start the operation using
startBackground
. The value
depends on information from the hardware.
Example: Display Scans Output by Hardware
Generate data on an analog output channel and to see how many scans are output by the hardware.
Create a session and add an analog output channel.
s = daq.createSession('ni'); ch = addAnalogOutputChannel(s,'Dev1','ao1','voltage');
Queue some output data and start the generation.
s.queueOutputData(linspace(-1, 1, 1000)'); startForeground(s);
Examine the ScansOutputByHardware
property.
s.ScansOutputByHardware
ans = 1000
ScansQueued
— Number of scans prepared for device output
numeric
This property is read-only.
Number of scans queued to the device output channels. Add scans to the
queued with queueOutputData
. The
ScansQueued
property value decreases when the
hardware reports that it has successfully output data.
Example: Monitor Scans Queue
Queue some output data to an analog output channel and examine the session properties to see how many scans are queued.
Create a session and add an analog output channel.
s = daq.createSession('ni'); ch = addAnalogOutputChannel(s,'Dev1','ao1','voltage');
Queue some output data, then examine the ScansQueued
property to see the number of scans queued.
s.queueOutputData(linspace(-1,1,1000)'); s.ScansQueued
ans = 1000
StandardSampleRates
— Standard available scan rates
double array
This property is read-only.
Standard sample rates supported by your audio device. You can choose to use the standard rates or use values within the supported range. See UseStandardSampleRates for more information.
View the standard sample rates for DirectSound audio devices:
s = daq.createSession('directsound')
s.StandardSampleRates'
ans = 8000 8192 11025 16000 22050 32000 44100 47250 48000 50000 88200 96000 176400 192000 352800
Data Types: double
TriggersPerRun
— Number of digital triggers per session acquisition run
numeric
Number of digital triggers per session acquisition run, returned as a double. This is the number of times the specified trigger executes for one acquisition or generation session.
Example: Specify Number of Triggers Per Operation
Create a session and add channels and trigger to the session.
s = daq.createSession('ni'); addAnalogInputChannel(s,'Dev1', 0, 'voltage'); addAnalogInputChannel(s,'Dev2', 0, 'voltage'); addTriggerConnection(s,'Dev1/PFI4','Dev2/PFI0','StartTrigger');
Display the session TriggersPerRun
property.
s.TriggersPerRun
ans = 1
Set the trigger to run twice during the operation.
s.TriggersPerRun = 2
s = Data acquisition session using National Instruments hardware: Will run 2 times for 1 second (1000 scans) at 1000 scans/second. Trigger Connection added. (Details) Number of channels: 2 index Type Device Channel MeasurementType Range Name ----- ---- ------ ------- --------------- ---------------- ---- 1 ai Dev1 ai0 Voltage (Diff) -10 to +10 Volts 2 ai Dev2 ai0 Voltage (Diff) -10 to +10 Volts
Data Types: double
TriggersRemaining
— Number of digital triggers remaining in acquisition
numeric
This property is read-only.
The number of triggers remaining for this acquisition or generation session, returned as a double. This value depends on the number of triggers set using TriggersPerRun.
Example: Display Number of Triggers Remaining in Operation
Create a session and add channels and a trigger to the session.
s = daq.createSession('ni'); addAnalogInputChannel(s,'Dev1', 0, 'voltage'); addAnalogInputChannel(s,'Dev2', 0, 'voltage'); addTriggerConnection(s,'Dev1/PFI4','Dev2/PFI0','StartTrigger');
Display the session TriggersRemaining
property.
s.TriggersRemaining
ans = 1
Data Types: double
UserData
— Custom data
any data
Custom data, specified as any MATLAB® data type and format.
Example: Create a session and define its
UserData
property as a struct with custom
fields.
s = daq.createSession('ni');
s.UserData.Data = [];
s.UserData.TimeStamps = [];
s.UserData.StartTime = [];
Set the start time, and append event information to the log fields stored
in UserData
.
s.UserData.StartTime = eventData.TriggerTime; s.UserData.Data = [s.UserData.Data; eventData.Data]; s.UserData.TimeStamps = [s.UserData.TimeStamps; eventData.TimeStamps];
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| char
| string
| struct
| table
| cell
| function_handle
| categorical
| datetime
| duration
| calendarDuration
| fi
UseStandardSampleRates
— Configure session to use standard sample rates
true
(default) | false
Use this property to specify if your audio channel uses standard sample
rates supported by your device or a user-specified value. To use
non-standard sample rates, set the value to false
and set
the session Rate to the desired
value.
Example: Configure a nonstandard sample rate
Add an audio channel to a session and change the
UseStandardSampleRates
property.
s = daq.createSession('directsound');
addAudioInputChannel(s,Audio1,1);
s.UseStandardSampleRates = false
s = Data acquisition session using DirectSound hardware: Will run for 1 second (44100 scans) at 44100 scans/second. Number of channels: 1 index Type Device Channel MeasurementType Range Name ----- ---- ------ ------- --------------- ------------- ---- 1 audi Audio1 1 Audio -1.0 to +1.0
Specify a different scan rate.
s.Rate = 8500
s = Data acquisition session using DirectSound hardware: Will run for 1 second (8500 scans) at 8500 scans/second. Number of channels: 1 index Type Device Channel MeasurementType Range Name ----- ---- ------ ------- --------------- ------------- ---- 1 audi Audio3 1 Audio -1.0 to +1.0
Data Types: logical
Vendor
— Data acquisition hardware vendor information
vendor object
This property is read-only.
Data acquisition hardware vendor information associated with the session, returned as a vendor object with the following properties:
ID FullName AdaptorVersion DriverVersion IsOperational
This object is the same as the corresponding vendor object returned by the
daq.getVendors
function.
Example: Create a session and get information its vendor.
s = daq.createSession('ni');
v = s.Vendor
v = Data acquisition vendor 'National Instruments': ID: 'ni' FullName: 'National Instruments' AdaptorVersion: '3.3 (R2013a)' DriverVersion: '9.2.3 NI-DAQmx' IsOperational: true
Version History
Introduced in R2010b
See Also
Topics
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)