SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

READ ROW

Name:
    READ ROW
Type:
    I/O Command
Purpose:
    Reads row oriented data into variables.
Description:
    Dataplot is a column oriented system. That is, columns denote variables while rows denote observations.

    Sometimes you may encounter data files that are row oriented, that is rows denote variables while columns denote observations. This is often the case when the number of variables is significantly greater than the number of observations.

    The READ ROW command was added to better accomodate these types of data files. With the ROW READ the file is read one row at a time and each row is added as a Dataplot variable. Only a single variable name is given to READ ROW command. This name serves as the "base name". So if Y is the variable name given and there are 25 rows of data, variables Y1, Y2, ..., Y25 will be created by the READ ROW command.

    The READ ROW command is only supported for numeric data. However, the rows do not need to contain the same number of data values.

    If the maximum number of available columns is reached, the READ ROW command will be terminated. However, any rows that have already been successfully read will still be retained. If there in error in reading a specific row, that row will be skipped and Dataplot will go to the next row.

    The READ ROW command generates a limited amount of feedback. It prints feedback for the first row read and the last row read only. If you want to see what variable names were created, you can enter the command

      STATUS VARIABLES (or STATUS V)
Syntax 1:
    READ ROW <y>
    where <y> is the base name for the variables being read.

    This syntax is used to read from the terminal or from within a macro file. All lines are read until an END OF DATA is encountered.

    In practice, READ ROW is not typically used for terminal reads. However, it does work.

Syntax 2:
    READ <file> <y>
    where <file> is the name of the file where the data resides;
    and    <y> is the base name for the variables being read.

    This syntax is used to read from a file. All lines are read until an END OF DATA is encountered, the physical end of file is encountered, or the maximum number of variables is reached.

Examples:
    READ ROW FILE.DAT Y
Note:
    By default, Dataplot peforms free format reads. However, it has the capability for supporting Fortran style formats. Formatted reads can be about 10 times faster on many systems which can be helpful for large data files. Enter HELP READ FORMAT for more details.

    Note that Fortran formats are based on the decimal point lining up consistenly between rows. Spreadsheet programs such as Excel tend to generate either right justified or left justified columns when generating fixed width ASCII files. These are typically not consistent with Fortran formatted reads.

Note:
    Blank lines in data files are ignored.
Note:
    In order to determine whether the first argument is a file name or a variable name, it looks for a period in the name. If it finds one, it assumes a file name. If it does not, it assumes a variable name. If your file name does not contain a period, attach a trailing period (no spaces) to the file name on the READ command.
Note:
    Dataplot does not assume specific extensions for file names. Although using conventions (e.g., ".DAT" or ".TXT" for data files, ".DP" for Dataplot macros) can be helpful for distinguishing between types of files, this is more for the analysts convenience. Dataplot itself does not enforce any conventions.

    File names have the following restrictions:

    1. The file name should be a valid file name for the local operating system.

    2. The file name should contain a period "." in the file name itself or as a trailing character. Dataplot strips off trailing periods on those systems where it is appropriate to do so. On systems where trailing periods can be a valid file name (e.g., Unix), Dataplot tries to open the file with the trailing period. If this fails, it then tries to open the file with the trailing period stripped off.

    3. If the file name contains spaces or hyphens, then it needs to be enclosed in quotes.

    4. File names are currently limited to 80 characters. This can in particular be a problem if the file name is contained within a long path name. The following can be helpful in these cases.

      • You can use the CD command to make the path where the file is stored the current directory. This is most useful for data files. For example,

        pwd
        cd <path where data file resided>
        read file.dat ...
        cd ^CURDIR

        The pwd command is used to save the current directory. The cd command is then used to set the current directory to the path where the data resides, the read is performed, and then the cd command is used to restore the original working directory (the cd command saves the current path in the string CURDIR).

      • You can use the SEARCH DIRECTORY command to specify an additional directory to search for file names.
Note:
    File names are case sensitive on Unix/Linux/Mac OS X systems. For these systems, Dataplot attempts to open the file as given. If this fails, it attempts to open the file as all upper case characters. If this fails, it attempts to open the file as all lower case characters.

    As a further caution for Unix/Linux hosts, certain expansion characters (specifically ~ to refer to your home directory) are interpreted by the shell and are not recognized by the Fortran compiler. These expansion characters are interpreted as literal characters and do not yield the intended file name.

Note:
    In general, Dataplot does not read binary data. However, it can read and write binary data using Fortran unformatted I/O. Note that although the Fortran standard includes unformatted I/O, the implementation details are left to the individual compiler. This means that Fortran unformatted files are not portable across systems and compilers.

    The primary use for this option is if you have a large data file that you will be accessing frequently. In this case, it can speed up the I/O to save a binary version of the file (you should keep the original ASCII version).

    For details, enter HELP SET READ FORMAT.

Default:
    1. If no file name is specified and a CALL is being executed, then the data values should be listed directly in the DATAPLOT sub-program immediately after the READ command (do not forget the END OF DATA statement).

    2. If no file name is specified and the commands are being manually entered/executed one at a time from the terminal, then the data should be entered directly from the terminal immediately after the READ command (also terminated by an END OF DATA statement).
Synonyms:
    None
Related Commands: Applications:
    Data Input
Implementation Date:
    2018/10
Program:
     
    READ ROW Y
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    16 17 18 19 20 21 22 23 24 25
    END OF DATA
    SET WRITE DECIMALS 0
    PRINT Y1 Y2
        
    The following output is returned
     
    ------------------------------
                 Y1             Y2
    ------------------------------
                  1             16
                  2             17
                  3             18
                  4             19
                  5             20
                  6             21
                  7             22
                  8             23
                  9             24
                 10             25
                 11              0
                 12              0
                 13              0
                 14              0
                 15              0
     
        

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 10/15/2018
Last updated: 10/15/2018

Please email comments on this WWW page to alan.heckert@nist.gov.