This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

isvalid (serial)

Determine whether serial port objects are valid


out = isvalid(obj)


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.


Suppose you create the following two serial port objects.

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

s2 becomes invalid after it is deleted.


isvalid verifies that s1 is valid and s2 is invalid.

sarray = [s1 s2];
ans =
     1     0


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.

See Also


Introduced before R2006a