Lesson 14: Managing M-files


While using MATLAB, one frequently wishes to create or edit an M-file and then return to MATLAB. One wishes to keep MATLAB active while editing a file since otherwise all variables would be lost upon exiting.

This can be easily done using the !-feature. If while in MATLAB, you precede it with an !, any system command---such as those for editing, printing or copying a file---can be executed without exiting MATLAB. For example, the MATLAB command

	>> !emacs rotate.m &
will let you edit the file named rotate.m using the emacs editor.

As noted in lesson 1, it is advisable to open two windows, keeping MATLAB active in one window and your editor active in the other.