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 MATRIX

Name:
    READ MATRIX
Type:
    Support Command
Purpose:
    Reads data into a matrix:

    1. from a mass storage file;
    2. from within a CALLed DATAPLOT sub-program;
    3. from the terminal.
Description:
    The rules regarding READ MATRIX are as follows:

    1. Only one matrix is read for a given READ MATRIX command (additional matrices on the READ FUNCTION line are ignored).

    2. In scanning for the matrix, the full line image is scanned. By default, a maximum of 1024 characters are read from a file. To increase this, use the command MAXIMUM RECORD LENGTH. When reading from the terminal, a maximum of 255 characters are read.

    3. Data values on a line image must be separated by at least one blank.

    4. Data values can be free-format. They need not be aligned in specific columns.

    5. The format of individual data values is general. It can be integer, floating point, or exponential. It is stored internally as a single precision real number.

    6. All reads start from the beginning of the file (for variations of this, see the SKIP and ROW LIMITS commands).

    7. The analyst need not be concerned about the number of observations or the number of variables for the matrix. DATAPLOT automatically determines and reports these values at the end of the read.

    8. The read terminates when a line image is encountered which consists of

        END OF DATA

      or

        END DATA

      or when the end of the file is reached.

    9. The individual columns of the matrix are available as variables (e.g., for matrix M, the columns are M1, M2, and so on).
Syntax 1:
    READ MATRIX <mat>
    where <mat> is the name for the matrix.

    This syntax is used to read a matrix from the terminal or from within a DATAPLOT sub-program.

Syntax 2:
    READ MATRIX <file> <mat>
    where <file> is the name of the mass storage file where the data resides;
    and <mat> is the name for the matrix.

    This syntax is used to read a matrix from a file.

Examples:
    READ MATRIX CALIB. M
Note:
    By default, DATAPLOT does free format reads. However, it has the capability for supporting FORTRAN style formats. Formatted reads can be about 10 times faster on many systems. This can be helpful for large data files. Enter HELP READ FORMAT for more details.
Note:
    The command

      DIMENSION MATRIX COLUMNS <value>

    defines the maximum number of columns in a matrix whenn executing matrix-based commands.

    If you are using free format reads, this value needs to be set as least as large as the number of columns you want to read.

    If you have entered a SET READ FORMAT command, then this value must be set to exactly the number of columns you want to read. If the value is not exact, then the REASD MATRIX command will not give the expected results.

    The default value is 100 columns.

Note:
    If you are reading a large number of columns, you may need to enter the following command

      MAXIMUM RECORD LENGTH <value>

    with <value> denoting the maximum number of columns to read in the file. The default value is 1024.

Note:
    Blank lines in data files are ignored.
Note:
    DATAPLOT supports the ability to embed comment lines within the data file. Enter HELP COMMENT CHECK for details.
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 has no restrictions on the file name other than it be a valid file name on the local operating system and that it 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.

    Some users prefer to give all data files a ".DAT" or ".dat" extension. Although this is a useful method for keeping track of data files, it is strictly a user convention and is not enforced by DATAPLOT in any way.

Note:
    File names are case sensitive on Unix file systems. For Unix, 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. All other currently supported systems are not case sensitive regarding file names.

    As a further caution for Unix 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.

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 MATRIX command (do not forget the END OF DATA statement).

    2. If no file name is specified and 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 MATRIX command (also terminated by an END OF DATA statement).
Synonyms:
    None
Related Commands: Applications:
    Data I/O
Implementation Date:
    Pre-1987
Program:
     
    READ MATRIX M
    1 3 2
    7 3 1
    8 1 2
    END OF DATA
        
Date created: 05/30/2023
Last updated: 05/30/2023

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