Documentation Center

  • Trials
  • Product Updates

isrunning

Determine whether device object is running

Syntax

bool = isrunning(obj)

    Note:   You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.

Description

bool = isrunning(obj) returns true if the device object obj is running, otherwise false. A device object is running if the value of its Running property is set to On.

If obj is an array of device objects, bool is a logical array where each element in bool represents the corresponding element in obj. If an object in obj is running, the isrunning function sets the corresponding element in bool to true, otherwise false. If any of the device objects in obj is invalid, isrunning returns an error.

Examples

Create an analog input object and add a channel.

ai = analoginput('winsound');
addchannel(ai, 1)

To put the analog input object in a running state, configure a manual trigger and then start the object.

set(ai, 'TriggerType', 'Manual')
start(ai)

Use isrunning to check the state of the object.

bool = isrunning(ai)
bool =
   1

Create an analog output object.

ao = analogoutput('winsound');

Use isrunning to determine which of the two objects is running.

bool = isrunning([ai ao])
bool =
     1     0

See Also

| | | |

Was this topic helpful?