Data Lines are, of course, the most important building block in .nd files. The use of the MatLab functions strtok and str2num allows a very flexible formatting, which makes file reading and editing much easier for humans.
The following example gives some layers of a PREM (Dziewonski & Anderson, 1981) like model. In PREM, all six of the quantities representable in .nd files are given.
0.000 5.80000 3.20000 2.60000 1451.91656 600.00000 15.000 5.80000 3.20000 2.60000 1451.91656 600.00000 15.000 5.80000 3.20000 2.60000 1451.91656 600.00000 24.400 6.80000 3.90000 2.90000 1345.91217 600.00000
(Note that the formatting of this example is just chosen to enhance the readability. It is not necessary to have all decimal points in the same positions or use only one space as separator!)
Many models, like IASP91 (Kennet & Engdahl, 1991) do not specify some quantities. If the missing quantities are at the end of the line, you may simply omit them: IASP91 does not specify density and Q factors. The Data Lines in an .nd file may look like this:
35.000 8.04000 4.47000 77.500 8.04500 4.48500 120.000 8.05000 4.50000 165.000 8.17500 4.50900 210.000 8.30000 4.51800 210.000 8.30000 4.52200 260.000 8.48250 4.60900 310.000 8.66500 4.69600
This will be interpreted as depth in the first column, vp in the second column and vs in the third column.
If, for example, the S wave velocity vs is undefined but a density given, the Data Lines have to look like this:
0.000 5.80000 -1 2.60000 15.000 5.80000 -1 2.60000 15.000 5.80000 -1 2.60000 24.400 6.80000 -1 2.90000
This will be interpreted as depth in the first column, vp in the second column, vs undefined and density in the fourth column. The "-1" entries define the respective quantity as unknown.
Omitting entries in the middle of the line as in
0.000 5.80000 2.60000 15.000 5.80000 2.60000 15.000 5.80000 2.60000 24.400 6.80000 2.90000
Would again be interpreted as depth in the first column, vp in the second column and vs in the third column. Since an arbitrary number of white space is allowed as separator between entries, the longer gap between the second and third column wouldn't be interpreted as missing value!