MATLAB Function Reference Previous page   Next Page
edit

Edit or create M-file

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

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/Debugger. To make the prompt appear, specify it in preferences for Prompt.

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, edit private/fun, or edit class/private/fun edit a method, private function, or private method for the class named class.

Remarks

To specify the default editor for MATLAB, select Preferences from the File menu. On the Editor/Debugger panel, select MATLAB editor 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:

where

For example,

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:

See Also

open, type


Previous page  echo eig Next page

© 1994-2005 The MathWorks, Inc.