|MATLAB Function Reference|
Edit or create M-file
As an alternative to the
edit function, select New or Open from the File menu in the MATLAB desktop or any desktop tool.
opens a new editor window.
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.
opens the specified file.
edit fun1 fun2 fun3 ...
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
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.
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
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
$EDITORis the name of your default editor, for example,
emacs; leaving it as
$EDITORmeans your default system editor will be used.
-optionis a valid option flag you can include for the specified editor.
$FILEmeans the filename you type with the
editcommand will open in the specified editor.
means that when you type
edit foo, the file
foo will open in the
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