
 
Dataplot Data Types 

No Data Typing Commands  You do not need to prespecify data types. Dataplot automatically determines the correct data type based on usage. In fact, the Dataplot language does not provide any data typing commands. In most cases, you do not need to worry about correct data types. 
Data Stored Internally as Single Precision Numbers  Dataplot stores numbers internally as single precision floating point numbers. Many internal calculations (e.g., fitting) are performed using double precision arithmetic. However, the results are saved in single precision. On some platforms (e.g., SUN and most Unix workstations), Dataplot can be built in such a way that single precision defaults to double precision. For most applications, this should not be necessary. Contact Alan Heckert if you would like more information about this. 
Recognized Data Types  Dataplot recognizes the following data types: 


Numbers 

Numbers are Unnamed Scalars 
Numbers are unnamed scalars. They may appear in a variety of
different kinds of commands. Note the 20 and 50 in

General Rule: Parameter Can Be Used In Place of a Number in a Command Line 
With the exception of the FIT and PREFIT commands, the
general rule in Dataplot is that anywhere a number appears
in a command line, it could equally well have been replaced
by a parameter, as in the following analogues to the above:
LET Y1 = 20 LET X2 = 50 LET Y2 = 50 BOX X1 Y1 X2 Y2 LET START = 0 LET INC = .1 LET STOP = 10 PLOT SIN(X) FOR X = START INC STOP LET A = 2.5 LET Y = X+A 
Expressions Not Necessarily Interchangeable with Numbers and Parameters 
However, note that expressions involving numbers and parameters
are not necessarily interchangeable with numbers and parameters.
For example, the following is NOT valid
LET Y1 = Y110 LET X2 = X2+5 LET Y2 = Y23 BOX X1 Y1 X2 Y2 
FIT and PREFIT Are An Exception 
The FIT and PREFIT commands are an exception because the
command lines
FIT Y = A+B*X+C*X**D

Numbers Stored Internatlly As Single Precision Floating Point 
All numbers are stored internally in Dataplot as single
precision floating point. If the analyst wishes to specify
a decimal number, as in
LET Y = X**2. LET Y = X**2.0 LET Y = X**2.00 
Defining Numbers With Large Exponents 
To define numbers with large exponents (for example, 7.4
raised to the 15th power), the analyst should use the
** (exponentiation) operator directly, as in
Negative exponents are handled in a similar fashion, as in

Return to Main Menu  


Parameters 

Parameters Are Named Scalars 
A parameter is a named scalar and can be defined via the
LET command, as in
LET B = 3.97 LET C = 5.38 LET D = 2.4*10**(8) LET E = B**24*A*C LET F = MEAN X 
Internally Defined Parameters 
Two internallyprovided parameters which the analyst can
use are
INFINITY
FIT Y = A+B*X**C EXCEPT X 100 TO INFINITY 
Caution When Using BuiltIn Parameters With FIT 
Be wary of the use of PI (and other automatically created
parameters) in FIT and PREFIT expressions; like all
parameters, Dataplot will attempt to determine least
squares estimates for it. Thus rather than use

Parameters Can Be Substituted For Numbers 
With the exception of the abovementioned FIT and PREFIT
exclusion, parameters can be substituted anywhere that numbers
appear. For example, suppose the analyst wished to override
the usual plot frame coordinates and specify that all
succeeding plots have lower left corner at (20,50) and for
the plot to be 30 units wide and 30 units high (that is, have
the upper right corner at (50,80). This can be done
explicitly by
LET Y1 = 50 LET X2 = 50 LET Y2 = 80 FRAME CORNER COORDINATES X1 Y1 X2 Y2
LET Y1 = 50 LET X2 = X1+30 LET Y2 = Y1+30 FRAME CORNER COORDINATES X1 Y1 X2 Y2 
Use Of Paramters With The CrossHair Command 
This capability of substituting parameters for numbers is
especially convenient for diagram construction on terminals
which have bui1tin hardware for inputting screen coordinates
via crosshair, 1ightpen, or equivalent. Suppose it is
desired to draw a line betveen two points on the screen which
the analyst will interactively specify via the crosshair.
One way is to

Return to Main Menu  


Variables 

Variables Are Named Vectors 
A variable is a named vector (a named singledimension array),
and can be defined via the LET, READ, SERIAL READ, and DATA
commands, as in the following examples
LET Z = PATTERN 1 2 3 FOR I = 1 2 9 LET U = NORMAL RANDOM NUMBERS FOR I = 1 1 100 LET X2 = X**2LOG(Y) LET Y2 = SQRT(X+Y**3) LET Y = DATA 1 5 10 25 34 46 22 17
1 1 2 4 3 9 4 16 5 25 END OF DATA
1 1 2 4 3 9 4 16 5 25 END OF DATA 
Variables Most Common Component In Dataplot 
Variables are the most commonlyhandled component in Dataplot,
as in
FIT Y = A+B*LOG(X+C) LET X2 = LOG(X) 
Rules For Variable Names 
The following are the rules for names (variables, parameters,
matrices, functions, and strings) in Dataplot.

Return to Main Menu  


Strings 

Dataplot Provides Some Limited String Support 
Dataplot provides limited support for strings. The most
common usage of strings is in labeling plots. Strings can
be particularly useful in this regard for reading titles and
labels from a file in general purpose macros. Another common
usage is building file names in loops. For example, suppose
you want to perform the same analysis on the files CALIB1.DAT
to CALIB100.DAT. This can be encapsulated in a loop
as follows:
LET STRING EXT = .DAT LOOP FOR K = 1 1 100
LET STRING FILE = ^BASE&^NUMBER&^EXT READ ^FILE X1 TO X10 ... REST OF ANALYSIS 
The "^" And "&" Operators  The above loop demonstrates the two operators that Dataplot provides for manipulating and using strings. The ^ character is the Dataplot substitute character. It replaces the succeeding string or parameter with the value of that string or paramaeter. This substitution is done before the command is parsed, so it is very general. The & character is the Dataplot concatenate character. It is used by Dataplot to concatenate two strings together. At this time, Dataplot does not support any functions for extracting a subset of a string. 
Commands For Creating Strings  There are two commands for creating strings in Dataplot. The READ STRING command is used to read a string from a file. The LET STRING command, demonstrated in the loop above, can also be used. Both of these commands preserve the case of the string as entered (versions of Dataplot prior to 4/96 may convert all characters to upper case for the LET STRING command). 
Emulating Arrays Of Strings 
Dataplot does not currently support arrays of strings.
However, this capability can be emulated somewhat with the
use of the substitute character (^). For example, suppose
you have the 50 state names in a file, one state per line.
You can read these into the strings S1 to S50 as follows:
SKIP NSKIP READ STRING STATES.DAT S^K
LET YPOS = 97 LET YINC = 3 LOOP FOR K = 1 1 50
TEXT ^S^K LET YPOS = YPOS  YINC IF YPOS < 5

Matrices 

Matrices Useful For Linear Algebra And Multivariate Analysis 
Matrices and matrix manipulation commands are useful for solving
linear algebra problems. They also find common usage in
multivariate statistics. For example, Dataplot provides macros
for performing discriminant analysis, canonical correlation, and
biplots using the matrix commands.
The Dataplot commands that operate on matrices are documented in Chapter 4 of Volume II of the Dataplot Reference Manual. Matrices cannot be used in Dataplot except for these commands that explicitly require them. Note that the individual columns of a matrix can be used (Dataplot appends the column number to the matrix name). 
Commands To Create Matrices  Matrices are created with READ MATRIX, CREATE MATRIX, or the MATRIX DEFINITION command. The columns of the matrix can be accessed by appending the column number to the matrix name (e.g., the columns of matrix M can be accessed via M1, M2, etc.). The rows of the matrix cannot be accessed directly. However, the MATRIX ROW command can be used to copy the contents of a matrix row to a column vector. A single element of an array can be extracted with the MATRIX ELEMENT command or by using something like M3(5) (this refers to the element in column 3 and row 5). Matrices cannot be used outside of the commands listed above. For example, you cannot enter LET S = SIN(M) where M is a matrix to compute the sine of all elements in a matrix. 
Return to Main Menu  


Complex Numbers 

Complex Numbers Generally Not Allowed  Dataplot operations and builtin functions assume single precision floating point numbers. In general, these cannot be replaced with complex numbers. 
Commands That Operate On Complex Numbers  The following LET subcommands specifically operate on complex numbers (the complex numbers are provided as a pair of real numbers): 
Library Functions That Work With Complex Numbers 
In addition, a number of builtin library functions can work
with complex numbers. These can be somewhat cumbersome since
the real and complex component are extracted with distinct
functions. For example, to compute the complex sin of a
complex number, enter the following 2 commands:
LET AC = CSIN(2,1) The following builtin functions support complex numbers:

Return to Main Menu  


Privacy
Policy/Security Notice
NIST is an agency of the U.S. Commerce Department.
Date created: 6/5/2001 