Saturday, July 25, 2009

clear (serial)

Remove a serial port object from the MATLAB workspace

Syntax

*

clear obj

Arguments

obj
A serial port object or an array of serial port objects.

Description


clear obj removes obj from the MATLAB workspace.

Remarks


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.

If you use the help command to display help for clear, then you need to supply the pathname shown below.

*

help serial/private/clear

Example

This example creates the serial port object s, 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

clf

Clear current figure window

Syntax

*

clf
clf reset

Description

clf deletes from the current figure all graphics objects whose handles are not hidden (i.e., their HandleVisibility property is set to on).

clf reset deletes from the current figure all graphics objects regardless of the setting of their HandleVisibility property and resets all figure properties, except Position, Units, PaperPosition, and PaperUnits to their default values.

Remarks

The clf command behaves the same way when issued on the command line as it does in callback routines - it does not recognize the HandleVisibility setting of callback. This means that when issued from within a callback routine, clf deletes only those objects whose HandleVisibility property is set to on.


clipboard

Copy and paste strings to and from the system clipboard.

Graphical Interface

As an alternative to clipboard, use the Import Wizard. To use the Import Wizard to copy data from the clipboard, select Paste Special from the Edit menu.

Syntax

*

clipboard('copy',data)
str = clipboard('paste')
data = clipboard('pastespecial')

Description

clipboard('copy', data) sets the clipboard contents to data. If data is not a character array, clipboard uses mat2str to convert it to a string.

str = clipboard('paste') returns the current contents of the clipboard as a string or as an empty string (' '), if the current clipboard content cannot be converted to a string.

data = clipboard('pastespecial') returns the current contents of the clipboard as an array using uiimport.

Note Requires an active X display on Unix and Java elsewhere.


clock

Current time as a date vector

Syntax

*

c = clock

Description

c = clock returns a 6-element date vector containing the current date and time in decimal form:

*

c = [year month day hour minute seconds]

The first five elements are integers. The seconds element is accurate to several digits beyond the decimal point. The statement fix(clock) rounds to integer display format.


close


Delete specified figure

Syntax


*

close
close(h)
close name
close all
close all hidden
status = close(...)

Description


close deletes the current figure or the specified figure(s). It optionally returns the status of the close operation.

close deletes the current figure (equivalent to close(gcf)).

close(h) deletes the figure identified by h. If h is a vector or matrix, close deletes all figures identified by h.

close name deletes the figure with the specified name.

close all deletes all figures whose handles are not hidden.

close all hidden deletes all figures including those with hidden handles.

status = close(...) returns 1 if the specified windows have been deleted and 0 otherwise.

Remarks

The close function works by evaluating the specified figure's CloseRequestFcn property with the statement:

*

eval(get(h,'CloseRequestFcn'))

The default CloseRequestFcn, closereq, deletes the current figure using delete(get(0,'CurrentFigure')). If you specify multiple figure handles, close executes each figure's CloseRequestFcn in turn. If MATLAB encounters an error that terminates the execution of a CloseRequestFcn, the figure is not deleted. Note that using your computer's window manager (i.e., the Close menu item) also calls the figure's CloseRequestFcn.

If a figure's handle is hidden (i.e., the figure's HandleVisibility property is set to callback or off and the root ShowHiddenHandles property is set on), you must specify the hidden option when trying to access a figure using the all option.

To delete all figures unconditionally, use the statements:

*

set(0,'ShowHiddenHandles','on')
delete(get(0,'Children'))

The delete function does not execute the figure's CloseRequestFcn; it simply deletes the specified figure.

The figure CloseRequestFcn allows you to either delay or abort the closing of a figure once the close function has been issued. For example, you can display a dialog box to see if the user really wants to delete the figure or save and clean up before closing.

No comments:

Post a Comment