Determine whether device object is running


bool = isrunning(obj)


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.


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.

ai.TriggerType, 'Manual')

Use isrunning to check the state of the object.

bool = isrunning(ai)
bool =

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
Was this topic helpful?