Skip to Main Content Skip to Search
Product Documentation

isvalid (serial) - Determine whether serial port objects are valid

Syntax

out = isvalid(obj)

Description

out = isvalid(obj) returns the logical array out, which contains a 0 where the elements of the serial port object, obj are invalid serial port objects and a 1 where the elements of obj are valid serial port objects.

Tips

obj becomes invalid after it is removed from memory with the delete function. Because you cannot connect an invalid serial port object to the device, you should remove it from the workspace with the clear command.

Examples

Suppose you create the following two serial port objects.

s1 = serial('COM1');
s2 = serial('COM1');

s2 becomes invalid after it is deleted.

delete(s2)

isvalid verifies that s1 is valid and s2 is invalid.

sarray = [s1 s2];
isvalid(sarray)
ans =
     1     0

See Also

clear | delete

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS