Matlab programming
1, for START: increment: end if the default step is 1, for START: end ---- end
While condition ---- end
2. MATLAB program: The suffix of M-script M-function is. M.
The script file stores a set of commands and function combinations that can be used for automatic repeated execution.
Run: M file editor run; command line prompt in the Command window> script file name
Workspace in the script file sharing command window
The function file runs in an independent workspace. Generally, parameters must be included and the result function is returned.
The function name is the same as the file name.
The first line comment of a function statement is called the H1 comment line. It is a summary of the function. You can use the lookfor command to search and display it.
Nargin, nargout
Program debugging
1. Remove the semicolon indicating the error line in the file and display the intermediate result.
2. Key variables in the analysis file are displayed.
3. Place the keyboard command in the selected place in the file to temporarily control the keyboard.
4. Add % to the front of the function statement and change it to a script. You can ask about the workspace.
MATLAB optimization calculation (2)