Syntax
Description
delete filename
deletes the named file from the disk. The filename
may include an absolute pathname or a pathname relative to the current directory. The filename
may also include wildcards, (*
).
delete(h)
deletes the graphics object with handle h
. The function deletes the object without requesting verification even if the object is a window.
delete('filename')
is the function form of delete
. Use this form when the filename is stored in a string.
Examples
To delete all files with a .mat
extension in the ../mytests/
directory, type
To delete a directory, use rmdir
rather than delete
:
delete (COM)
Delete a COM control or server
Syntax
Arguments
h
Handle for a COM object previously returned from actxcontrol
, actxserver
, get
, or invoke
.
Description
Release all interfaces derived from the specified COM server or control, and then delete the server or control itself. This is different from releasing an interface, which releases and invalidates only that interface.
Examples
Create a Microsoft Calender application. Then create a TitleFont
interface and use it to change the appearance of the font of the calendar's title:
f = figure('pos',[300 300 500 500]);
cal = actxcontrol('mscal.calendar', [0 0 500 500], f);
TFont = get(cal, 'TitleFont')
TFont =
Interface.mscal.calendar.TitleFont
set(TFont, 'Name', 'Viva BoldExtraExtended');
set(TFont, 'Bold', 0);
When you're finished working with the title font, release the TitleFont
interface:
Now create a GridFont
interface and use it to modify the size of the calendar's date numerals:
When you're done, delete the cal
object and the figure window. Deleting the cal
object also releases all interfaces to the object (e.g., GFont
):
Note that, although the object and interfaces themselves have been destroyed, the variables assigned to them still reside in the MATLAB workspace until you remove them with clear
.
whos
Name Size Bytes Class
GFont 1x1 0 handle
TFone 1x1 0 handle
cal 1x1 0 handle
Grand total is 3 elements using 0 bytes
delete (serial)
Remove a serial port object from memory
Syntax
Arguments
obj | A serial port object or an array of serial port objects. |
Description
delete(obj)
removes obj
from memory.
Remarks
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 clear
command. If multiple references to obj
exist in the workspace, then deleting one reference invalidates the remaining references.
If obj
is connected to the device, it has a Status
property value of open
. If you issue delete
while obj
is connected, then the connection is automatically broken. You can also disconnect obj
from the device with the fclose
function.
If you use the help
command to display help for delete
, then you need to supply the pathname shown below.
Example
This example creates the serial port object s
, connects s
to the device, writes and reads text data, disconnects s
from the device, removes s
from memory using delete
, and then removes s
from the workspace using clear
.
delete (timer)
Remove a timer object from memory
Syntax
Description
delete(obj)
removes timer object, obj
, from memory. If obj
is an array of timer objects, delete
removes all the objects from memory.
When you delete a timer object, it becomes invalid and cannot be reused. Use the clear
command to remove invalid timer objects from the workspace.
If multiple references to a timer object exist in the workspace, deleting the timer object invalidates the remaining references. Use the clear
command to remove the remaining references to the object from the workspace.
Remove custom property from COM object
Syntax
Arguments
h
Handle for a COM object previously returned from actxcontrol
, actxserver
, get
, or invoke
.
propertyname
A string specifying the name of the custom property to delete.
Description
Delete a property, propertyname
, from the custom properties belonging to object or interface, h
.
Examples
Create an mwsamp
control and add a new property named Position
to it. Assign an array value to the property:
No comments:
Post a Comment