| MATLAB Function Reference | ![]() |
Graphical Interface
As an alternative to the edit function, select New or Open from the File menu in the MATLAB desktop or any desktop tool.
Syntax
edit edit fun.m edit file.ext edit fun1 fun2 fun3 ... edit class/fun edit private/fun edit class/private/fun
Description
edit
opens a new editor window.
edit fun.m
opens the M-file fun.m in the default editor. Note that fun.m can be a MATLAB partialpath or a complete path. If fun.m does not exist, a prompt appears asking if you want to create a new file titled fun.m. After you click Yes, the Editor/Debugger creates a blank file titled fun.m. If you do not want the prompt to appear in this situation, select that check box in the prompt. Then when you type edit fun.m, where fun.m did not previously exist, a new file called fun.m is automatically opened in the Editor. To make the prompt appear, specify it in preferences for Prompt on page 7-38.
edit file.ext
opens the specified file.
edit fun1 fun2 fun3 ...
opens fun1.m, fun2.m, fun3.m, and so on, in the default editor.
edit class/fun can be used to edit a method, private function, or private method (for the class named , edit private/fun, or edit class/private/fun
class).
Remarks
To specify the default editor for MATLAB, select Preferences from the File menu. On the Editor/Debugger panel, select the MATLAB Editor/Debugger or specify another.
UNIX Users
If you run MATLAB with the -nodisplay startup option, or run without the DISPLAY environment variable set, edit uses the External Editor command. It does not use the MATLAB Editor/Debugger, but instead uses the default editor defined for your system in $matlabroot/X11/app-defaults/Matlab.
You can specify the editor that the edit function uses or specify editor options by adding the following line to your own .Xdefaults file, located in ~home
$EDITOR is the name of your default editor, for example, emacs; leaving it as $EDITOR means your default system editor will be used.
-option is a valid option flag you can include for the specified editor.
$FILE means the filename you type with the edit command will open in the specified editor.
means that when you type edit foo, the file foo will open in the emacs editor.
After adding the line to your .Xdefaults file, you must run the following before starting MATLAB:
For the HP 700 platform, the default editor is instead defined in $matlabroot/toolbox/matlab/general/edit.m. To change it, open the file edit.m and edit the line
See Also
| echo | eig | ![]() |