Environmental Engineering Reference
In-Depth Information
Fig. 2.5 Preferences, relevant for the editor
editor the programmer works on m-files. In the first chapter it was shown how
MATLAB
operations are stated in the command window. Even after few
exercises the user will recognize that it is often necessary to give a former command
again or to give it in a slightly different form; maybe just with a parameter name
altered. It was already shown that the command history view of the MATLAB
®
®
graphical user interface is an appropriate tool to go back to former commands. As
already mentioned an alternative way is to use the up- and down-arrow buttons of
the keyboard.
There is another alternative, which for most purposes turns out to be so powerful
that most users prefer it for their normal work in comparison to the command
window. MATLAB
command sequences can be gathered and stored as files. The
extension of these files is simply . m ; for that reason they are called M-files . What the
MATLAB
®
user does with M-files, is what programmers do with other program-
ming languages, as FORTRAN, JAVA or some C variant, just to mention some
names.
In order to create a new M-file we use the 'New
®
M-file' entries of the 'File'
main menu, as shown in Fig. 2.6 . In the same menu there is an entry for opening an
already existing M-file.
A simple example demonstrates the procedure. As just described, create a new
M-file. The MATLAB
!
editor appears. The main menu of the editor is depicted in
Fig. 2.7 . Type the following commands:
®
Search WWH ::




Custom Search