Remove serial port object from memory
obj is a serial port object or an
array of serial port objects.
This example creates the serial port object
a Windows® platform, connects
s to the device,
writes and reads text data, disconnects
the device, removes
s from memory using
and then removes
s from the workspace using
s = serial('COM1'); fopen(s) fprintf(s,'*IDN?') idn = fscanf(s); fclose(s) delete(s) clear s
When you delete
obj, it becomes an invalid object.
Because you cannot connect an invalid serial port object to the device,
you should remove it from the workspace with the
If multiple references to
obj exist in the workspace,
then deleting one reference invalidates the remaining references.
obj is connected to the device, it has
Status property value of
If you issue
connected, then the connection is automatically broken. You can also
obj from the device with the