Graphics Programs Reference
In-Depth Information
Fig. 2.2 Screenshot of MATLAB Text Editor showing the content of the fi le geochem.txt . The
fi rst line of the text is commented by a percent sign at the beginning of the line, followed by
the actual data matrix.
MAT-fi les are double-precision, binary fi les using .mat as extension. The
advantage of these binary mat-fi les is that they are independent from the
computer platforms running different fl oating-point formats. The command
save geochem_new.mat geochem
saves only the variable geochem instead of the entire workspace. The op-
tion - ascii , for example
save geochem_new.txt geochem -ascii
again saves the variable geochem , but in an ASCII fi le named geochem_new.
txt . In contrast to the binary fi le geochem_new.mat, this ASCII fi le can be
viewed and edited by using the MATLAB Editor or any other text editor.
2.6 Scripts and Functions
MATLAB is a powerful programming language. All fi les containing
MATLAB code use .m as extension and are therefore called M-fi les . These
fi les contain ASCII text and can be edited using a standard text editor.
However, the built-in Editor color highlights various syntax elements such
as comments (in green), keywords such as if , for and end (blue) and charac-
ter strings (pink). This syntax highlighting eases MATLAB coding.
Search WWH ::




Custom Search