Geoscience Reference
In-Depth Information
Fig. 2.2 Screenshot of MATLAB Editor showing the content of the i le geochem.txt . h e i rst
line of the text needs to be commented by a percent sign at the beginning of the line, followed
by the actual data array. h e -999 values need to be replaced by NaN s.
saves only the variable geochem instead of the entire workspace. h e option
-ascii , for example
save geochem_new.txt geochem -ascii
again saves the variable geochem , but in an ASCII i le named geochem_new.txt
in a l oating-point format with 8 digits:
1.0100000e+02 3.6570000e-01 6.3600000e-02
1.0200000e+02 2.2080000e-01 1.1350000e-01
1.0300000e+02 5.3530000e-01 5.1910000e-01
1.0400000e+02 5.0090000e-01 5.2160000e-01
1.0500000e+02 5.4150000e-01 NaN
1.0600000e+02 5.0100000e-01 NaN
In contrast to the binary i le geochem_new.mat, this ASCII i le can be viewed
and edited using the MATLAB Editor or any other text editor.
Such data i les, especially those that are produced by electronic instruments,
can look much more complicated than the example i le geochem.txt with a
single header line. In Chapters 7 and 8 we will read some of these complicated
and extensive i les, which are either binary or text i les and usually have long
headers describing the contents of the i les. At this point, let us have a look at
a variant of text i les that contains not only one or more header lines but also
unusual data types such as date and time, in a non-decimal format. We use
Movie
2.3
Search WWH ::




Custom Search