Documentation

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

clear (serial)

Remove serial port object from MATLAB workspace

Syntax

clear obj

Description

clear obj removes obj from the MATLAB® workspace, where obj is a serial port object or an array of serial port objects.

Examples

This example creates the serial port object s on a Windows® platform, copies s to a new variable scopy, and clears s from the MATLAB workspace. s is then restored to the workspace with instrfind and is shown to be identical to scopy.

s = serial('COM1');
scopy = s;
clear s
s = instrfind;
isequal(scopy,s)
ans =
     1

More About

collapse all

Tips

If obj is connected to the device and it is cleared from the workspace, then obj remains connected to the device. You can restore obj to the workspace with the instrfind function. A serial port object connected to the device has a Status property value of open.

To disconnect obj from the device, use the fclose function. To remove obj from memory, use the delete function. You should remove invalid serial port objects from the workspace with clear.

Introduced before R2006a

Was this topic helpful?