Matlab:clear,close,clc

Source: Internet
Author: User

Clear

Delete items in a workspace, freeing up system memory

Grammar:

Clear

Clear Name

Clear Name1 name2 Name3 ...

Clear Global Name

Clear-regexp expr1 expr2 ...

Clear Global-regexp expr1 expr2 ...

Clear keyword

Clear (' name1 ', ' name2 ', ' Name3 ',...)

Describe:

Clear Delete all variables in the workspace and release system memory

Clear name simply deletes the function or variable name in the M-file or Mex file within the workspace. You can choose to delete items by using the wildcard character (*). For example, clear my* can delete a variable that starts with my in any name in the workspace. It can remove the breakpoint in M-file, reinitialize the permanent variable, as long as the M-file is changed or cleared, the breakpoint set at the function or permanent variable will be removed. If a name is global, it is removed from the current workspace, but can also be obtained because it is declared to be global. If name is locked, it still stays in memory.

Clear Name1 name2 Name3 ... Removing Name1,name2,name3 from the workspace

Clear Global Name Remove global variable name

Clear-regexp expr1 expr2 ... Clears all matching regular expressions Expr1 expr2 ... All the variables

Clear Golbal-regexp expr1 expr2 .... Clears all matching regular expressions Expr1 expr2 ... All the global variables

Clear keyword clears all options marked with a keyword

Clear (' name1 ', ' name2 ', ' Name3 ',...) is the syntax representation of the function. This form is used when the variable name or function name is stored as a string.

Limit:

Cleard in Unix systems, it does not affect the amount of memory allocated to the MATLAB process.

Clc

Clear the Named window

Close

Delete a specific parameter

Grammar:

Close deletes the current parameter

Close (h) Delete the parameter named H

Close name removes a parameter named name

Close all remove arguments when all handles are not hidden

Close all hidden delete parameters that include handle shadowing

Status=close (...) When a particular window is deleted, returns 1, otherwise 0

Take Makesure5 's question, summarize the use of the CLC and the Clear command:

In Matlab, the CLC and clear commands are frequently used commands, and proficiency in the use of these two commands can provide great convenience for programming.
The CLC command is used to clear the contents of the command window, needless to say. No matter how many applications are opened, the command window has only one, so the CLC command clears the contents of the command window either when the script m file or the function m file is called.
The clear command can be used to clear the contents of the workspace. MATLAB has a basic workspace, which is identified by the base, and when a function m file is opened, it can create a lot of work space. Each function corresponds to a working space. For example, a graphical user interface program test may have a working space such as test, GUI_MAINFCN, Pushbutton1_callback, and so on. At this point, if you call the clear command, you need to be aware of:
If you call clear within the Pushbutton1_callback function, only the content within the Pushbutton1_callback workspace is deleted. Clear does not work for other workspaces, such as the base workspace.
You can use the Evalin command if the user wants to invoke the clear command in Pushbutton1 callback to delete the contents of the basic workspace.
The Evalin command executes the MATLAB statement in the specified workspace. One of the invocation formats is: Evalin (WS, Expression). WS is the name of the workspace, such as ' base ', and expression is a MATLAB statement.
Use Evalin (' base ', ' clear '); You can delete the data in the basic workspace.

Evalin command There are other uses, you can look at the help file.

Matlab:clear,close,clc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.