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


    I/O Command
    Write variables in a row-wise fashion.
    Dataplot is a column oriented system. That is, columns denote variables while rows denote observations. The WRITE command will write variables in this column-wise fashion.

    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 accomodate these types of files.

    Often these row-oriented files will contain a large number of rows and take a long time to read. Typically, you cannot use the SET READ FORMAT command on these files to speed up the read. The WRITE ROW command was added in order to allow you to create a version of the row oriented file that can be read using the SET READ FORMAT with the READ ROW command. This speed-up can be on the order of a factor of 10 to 20. The downside is that the new file is typically larger than the original file.

    The WRITE ROW command is only supported for numeric variables.

Syntax 1:
    WRITE ROW <var-list>
    where <var-list> is a list of variable names to write.

    This syntax is used to write to the terminal or from within a macro file.

    In practice, WRITE ROW is not typically used for terminal writes. However, it does work.

Syntax 2:
    WRITE ROW <file> <var-list>
    where <file> is the name of the file where the data resides;
    and     <var-list> is a list of variable names to write.

    This syntax is used to write to a file.

    The WRITE ROW is often used when there are a large number of variables. The TO syntax is supported for this command which is useful when there are a large number of variables to write.

    In order to determine whether the first argument is a file name or a variable name, Dataplot 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.
    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,

        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.
    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.

Related Commands:
    WRITE = Write variables to the screen or to a file.
    READ = Read data into variables.
    READ ROW = Read row oriented data into variables.
    SERIAL READ = Perform a serial read.
    SET WRITE FORMAT = Define a FORTRAN style format for writes.
    SET READ FORMAT = Define a FORTRAN style format for reads.
    CLIPBOARD = Various commands for reading from the system clipboard.
    Data Output
Implementation Date:
Program 1:
    skip 25
    read berger1.dat y x batch
    set write format 107F10.4
    write row berger1_row.dat y x batch

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