Page 28 - MATLAB Recipes for Earth Sciences
P. 28

2.5 Data Handling                                                19

           2.4 Data Storage

           This chapter is on how to  store,  import and  export data with MATLAB. In
           earth sciences, data are collected in a great variety of formats, which often
           have to be converted before being analyzed with MATLAB. On the other
           hand, the software provides a number of import routines to read many bi-
           nary data formats in earth sciences, such as the formats used to store digital
           elevation models and satellite date.
             A computer generally stores data as  binary digits or bits. A bit is similar
           to a two-way switch with two states, on = 1 and off = 0. In order to store
           more complex types of data, the bits are joined to larger groups, such as
           bytes consisting of 8 bits. Such groups of bits are then used to encode data,
           e.g., numbers or characters. Unfortunately, different computer systems and
           software use different schemes for encoding data. For instance, the repre-
           sentation of text using the widely-used text processing software Microsoft
           Word is different from characters written in Word Perfect. Exchanging

           binary data therefore is difficult if the various users use different computer
           platforms and software. As soon as both partners of data exchange use
           similar systems, binary data can be stored in relatively small fi les. The
           transfer rate of binary data is generally faster compared to the exchange of
           other fi le formats.
             Various formats for exchanging data have been developed in the last
           decades. The classic example for the establishment of a data format that
           can be used on different computer platforms and software is the American
           Standard Code for Information Interchange  ASCII that was fi rst published
           in 1963 by the American Standards Association (ASA). ASCII as a 7-bit
           code consists of 27=128 characters (codes 0 to 127). Whereas ASCII-1963
           was lacking lower-case letters, the update ASCII-1967, lower-case letters as
           well as various control characters such as escape and line feed and various
           symbols such as brackets and mathematical operators were also included.
           Since then, a number of variants appeared in order to facilitate the exchange
           of text written in non-English languages, such as the expanded ASCII con-
           taining 255 codes, e.g., the Latin–1 encoding.



           2.5 Data Handling


           The simplest way to exchange data between a certain piece of software and
           MATLAB is the ASCII format. Although the newer versions of MATLAB

           provide various import routines for file types such as Microsoft Excel bina-
   23   24   25   26   27   28   29   30   31   32   33