Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 
isvalid    Examples   See Also

Check for valid device objects, channels, or lines.

Syntax

isvalid(obj)

isvalid(obj.Channel(index))

isvalid(obj.Line(index))

Description

isvalid(obj) returns a "1" if obj is a valid device object and a "0" if obj is not a valid device object. An invalid object exists in the workspace but does not exist in the engine. Therefore, invalid objects are no longer associated with any hardware and should be cleared from the workspace.

isvalid(obj.Channel(index)) returns a logical array containing a "1" where the channels associated with obj are valid, and a "0" where they are not. Invalid channels are no longer associated with any hardware and should be cleared from the workspace.

isvalid(obj.Line(index)) returns a logical array containing a "1" where the lines associated with obj are valid, and a "0" where they are not. Invalid lines are no longer associated with any hardware and should be cleared from the workspace.

Note:
Typically, you use isvalid directly only when you are creating your own M-files.

Examples

Suppose you create the analog input object ai for a National Instruments board and add 8 channels to it.

To verify the device object is valid

To verify the channels are valid

If you delete a channel, then isvalid returns a logical "0" in the appropriate location

Typically, you will use isvalid directly only when you are creating your own M-files. Suppose you create the function func for use with the Data Acquisition Toolbox. If func is passed the previously defined device object ai as an input argument

the first thing you should do in the function is check if ai is a valid device object.

You can examine the Data Acquisition Toolbox M-files for examples using isvalid.

See Also

Functions

delete, ischannel, isline



[ Previous | Help Desk | Next ]