1. Ctrl + C interrupts the operation being performed
If the program accidentally enters the dead loop, or the calculation time is too long, you can use CTRL + C in the command window to break. MATLAB may be struggling to cope at this time, the response will be a little lag.
2. Figure command to create a new drawing window
Figure can open an empty drawing window, and the next drawing command can put the picture inside it without overwriting the previous drawing window. When there are multiple figure windows, executing commands such as plot in the command window overwrites the object in the current number window. the so-called current figure window, which is the last window to be viewed (can be obtained with the command GCF).
Figure (n), where the window numbered n is set to the currentfigure, appears at the top of all windows, and if the window does not exist, creates a new blank figure with number N.
(This blog is original, reproduced please specify the Source: http://www.cnblogs.com/pfli1995/p/4660017.html)
(Bo Master cnds in the corresponding article: http://blog.csdn.net/xuexiyanjiusheng/article/details/46959313)
3. Comment out a program:%{,%}.
The classic method is to use if 0, but the disadvantage is not intuitive enough, the commented out content still preserves the color of the code. You can now use the combination of% and {. After entering%{, the following code will be green, and the end of the note with%}.
You can also select the content you want to annotate, select Comment in the right-click menu (Uncomment remove the comment marker), or use the shortcut key ctrl+r.
Place the cursor in the line where you want the comment, and press Ctrl+r to change the line to a comment. Uncomment the same, the shortcut key is ctrl+t.
(In fact, this can be used directly, Matlab 2014b)
4. doc command name, open the Help document for the command
Unlike the help command, a description of the commands in MATLAB helps is more detailed, often with some examples, and is easier to understand.
5. CLC Clear Screen
Clears all input and output information from the command window, without affecting the history of the command.
6. Clear and Clear all
Clear variable name : You can clear the useless variables in the workspace, especially some particularly large matrices, when not in time to clean up, you can reduce memory consumption.
Clear All/clear clears all variables so that workspace has nothing, and when you restart the algorithm validation, it's best to do it once, so that the variables in workspace are at a glance.
7. Close all
If you have multiple drawing windows open, use this command to turn them off.
8. Up and down cursor keys↑↓
In the command window, the up and down cursor keys can copy commands from the history to the input location for quick re-execution . If you enter the first few letters of the command, such as [row, col] =, and then use the cursor key, only the command starting with these letters will be selected。
9. Tab completion
Remember the name of the command is not clear, you can enter a few letters at the beginning, and then press the TAB key, when only a command beginning with these letters, will automatically fill the command name, otherwise display a list of command names, convenient to choose from. Of course, it only works in the command window.
Cell mode
In a long script m file, it may be necessary to modify the paragraph repeatedly to see the effect, and the cell mode is very useful. The cell pattern is equivalent to copying the code in it to a command window to run . two% followed by a space (percent) to start a cell. when you place the input cursor in a cell, the background becomes light yellow and Ctrl+enter executes the code in the cell .
You do not need to save the m file when executing the code in the cell, and the M file may not be in the path list (pro-test is valid).
In cell mode, breakpoints do not work, and of course, breakpoints in called subroutines are normal.
11. Get a list of files, batch processing
MATLAB has built in some file operation commands, such as CD (switch working directory)(CD E:\inusing or CD ' E:\inusing '),dir (with LS, display directory file list) and so on.
The dir command can return a list of files and folders in a directory, in a struct array. If you need to batch some data files, and the file name does not have a certain regularity, you may need to use this command.
Some tips in matlab (Basic)