23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

clear (serial)<br />

2clear (serial)<br />

Purpose Remove a serial port object from the <strong>MATLAB</strong> workspace<br />

Syntax clear obj<br />

Arguments<br />

Description clear obj removes obj from the <strong>MATLAB</strong> workspace.<br />

Remarks If obj is connected to the device and it is cleared from the workspace, then obj<br />

remains connected to the device. You can restore obj to the workspace with the<br />

instrfind function. A serial port object connected to the device has a Status<br />

property value of open.<br />

2-268<br />

obj A serial port object or an array of serial port objects.<br />

To disconnect obj from the device, use the fclose function. To remove obj from<br />

memory, use the delete function. You should remove invalid serial port objects<br />

from the workspace with clear.<br />

If you use the help command to display help for clear, then you need to supply<br />

the pathname shown below.<br />

help serial/private/clear<br />

Example This example creates the serial port object s, copies s to a new variable scopy,<br />

and clears s from the <strong>MATLAB</strong> workspace. s is then restored to the workspace<br />

with instrfind and is shown to be identical to scopy.<br />

s = serial('COM1');<br />

scopy = s;<br />

clear s<br />

s = instrfind;<br />

isequal(scopy,s)<br />

ans =<br />

1<br />

See Also <strong>Function</strong>s<br />

delete, fclose, instrfind, isvalid<br />

Properties<br />

Status

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!