next up previous contents index
Next: Generating abscissas automatically Up: Preparing Input for plt Previous: Binary data files


Data specifications

Use a data specification to advise plt of the format of your data file, or to select rows from the file that you wish to plot. Any plt command may include a data specification. A data specification is required in order to use a binary data file that lacks a header. The data specification is a string beginning with ``:'', and always precedes the name of the data file in the plt command line. Up to four optional specifiers, separated by commas, can follow the ``:'', as in:

plt :s2,1024,2049,1 ecg.dat \
    -cz 8 .00781 -F"p 0,1n(Cred) 0,2n(Cblue)"

This command produces Figure 3.1 on page [*]. The data specification in this example is ``:s2,1024,2049,1'', the data file is ecg.dat, the -cz option is described in the next section, and the remaining arguments are options described later in this book. All four optional specifiers are shown in this example; in order, they are:

format
This specifier is used for binary data files only. It is a letter that indicates the data type, followed by a number that indicates the number of values (columns) per row. Use one of ``s'', ``f'', or ``d'' to specify short (integer), float, or double format data respectively. In the example, format is ``s2'', indicating that the input is a binary data file containing short integer data in 2 columns. If format is omitted, plt assumes the input is a text data file.

min-row
If present, plt excludes rows with smaller row numbers. In the example, min-row is 1024.

max-row
If present, plt excludes rows with equal or greater row numbers. In the example, max-row is 2049.

dec
If present, plt includes only one of every dec rows, beginning with min-row. In the example, dec is 1 (all rows are plotted); this is the default, and could have been omitted.

Omitted specifiers are replaced with default values; the defaults are to include all rows. For example, the specification ``:100'' excludes rows 1-99 and includes all others; the specification ``:2,,2'' excludes all odd-numbered rows, and ``:1,,2'' (or ``:,,2'') excludes all even-numbered rows.

If your data file contains an embedded prolog of a type other than the two-byte header used by plt, you may be able to skip over it using an appropriate value of min-row in your data specification. If the file contains binary data, and if the length of the prolog is not a multiple of the size of a row in bytes, you will need to use another method; the Unix utility dd may be useful for this purpose, as in:

\fbox{{\tt dd ibs=1 skip=}{\em nbytes} {\tt <}{\em data-file} {\tt \vert plt ...}}


next up previous contents index
Next: Generating abscissas automatically Up: Preparing Input for plt Previous: Binary data files
George B. Moody (george@mit.edu)
2005-04-26