Development Environment |
Opening Existing M-Files in the Editor/Debugger
To open an existing M-file in the Editor/Debugger, click the open button on the desktop or Editor/Debugger toolbar, or select File -> Open.
The Open dialog box opens, listing all MATLAB files. You can see different files by changing the selection for Files of type in the dialog box. Select the file and click Open. If you click the open icon from the desktop toolbar, the current directory files are shown, but if you open it from the Editor, the files in the directory for the current file are shown.
You can also open files from the Current Directory browser--see Opening Files. You can select a file to open from the most recently used files, which are listed at the bottom of the File menu in the Editor/Debugger and all other desktop tools. You can change the number of files appearing on the list--see Preferences for the Editor/Debugger.
If the Editor/Debugger is not already open, it opens with the file displayed. If it is already open, the file appears either in its own window or as a tab in the current window as specified in the preference for Opening files in editor. To make a document in the Editor/Debugger become the current document, click it or use the Window menu or tabs.
You can set a preference that instructs MATLAB, upon startup, to automatically open the files that were open when the previous MATLAB session ended. For instructions, see the On restart preference in General Preferences for the Editor/Debugger.
Function Alternative
Use the edit
or open
function to open an existing M-file in the Editor/Debugger. For example, type
to open the file collatz.m
in the Editor/Debugger, where collatz.m
is on the search path or in the current directory. Use the relative or absolute pathname for the file you want to open if it is not on the search path or in the current directory.
Creating a New M-File in the Editor/Debugger | Opening a Selection |