Determine whether analog input object is logging data


bool = islogging(obj)


bool = islogging(obj) returns true if the analog input object obj is logging data, otherwise false. An analog input object is logging if the value of its Logging property is set to On.

If obj is an array of analog input objects, bool is a logical array where each element in bool represents the corresponding element in obj. If an object in obj is logging data, islogging sets the corresponding element in bool to true, otherwise false. If any of the analog input objects in obj is invalid, islogging 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 logging state, start acquiring data. The example acquires 10 seconds of data to increase the amount of time that the object remains in the logging state.

ai.SamplesPerTrigger = 10*

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

bool = islogging(ai)
bool =

Create a second analog input object.

ai2 = analoginput('winsound');

Start one of the analog input objects again, such as ai, and use islogging to determine which of the two objects is logging.

bool = islogging([ai ai2])
bool =
     1     0
Was this topic helpful?