Main Content

release

(Not recommended) Release session hardware resources

This session object function is not recommended. Use DataAcquisition object functions instead. See Compatibility Considerations.

Description

example

release(s) releases all reserved hardware resources in the session s, and flushes any data you have queued in the hardware in that session.

A session might reserve exclusive access to the hardware associated with it. If you need to use the hardware in another session or by applications other than MATLAB®, use release(s) to unreserve the hardware and clear its data.

Hardware resources associated with a session are automatically released when you delete the session object or assign a different value to the variable containing the session object.

Examples

collapse all

Create a session and add an analog input voltage channel and acquire data in the foreground:

s1 = daq.createSession('ni');
addAnalogInputChannel(s1,'cDAQ3Mod1','ai0','Voltage');
startForeground(s1)

Release the session hardware and create another session object with an analog input voltage channel on the same device as the previous session. Acquire in the foreground:

release(s1);
s2 = daq.createSession('ni');
addAnalogInputChannel(s2,'cDAQ3Mod1','ai2','Voltage');
startForeground(s2);

Input Arguments

collapse all

Data acquisition session, specified as a session object. Create the session object using daq.createSession. Use the data acquisition session for acquisition and generation operations. Create one session per vendor and use that vendor session to perform all data acquisition operations.

Version History

Introduced in R2010b

collapse all

R2020a: session object interface is not recommended

Use of this function with a session object is not recommended. To access a data acquisition device, use a DataAcquisition object with its functions and properties instead.

For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.