issending

Determine whether analog output object is sending data

Syntax

bool = issending(obj)

Description

bool = issending(obj) returns true if the analog output object obj is sending data to the hardware device, otherwise false. An analog output object is sending if the value of its Sending property is set to On.

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

Examples

Create an analog output object and add a channel.

ao = analogoutput('winsound');
addchannel(ao, 1);

To put the analog output object in a sending state, start acquiring data. The example sends 10 seconds of data to increase the amount of time that the object remains in the sending state.

rate = ao.SampleRate
putdata(ao, ones(10*(rate),1));
start(ao)

When the call to the start function returns, and the object is still sending data, use issending to check the state of the object.

bool = issending(ao)
bool =
   1

Create a second analog output object.

ao2 = analogoutput('winsound');

Start one of the analog output objects again, such as ao, and use issending to determine which of the two objects is sending.

rate = ao.SampleRate
putdata(ao, ones(10*(rate),1));
start(ao)
bool = issending([ao ao2])
bool =
     1     0
Was this topic helpful?