Strings are often used with the substitution character ("^" by default). The substitution character inserts the value of a previously defined parameter or string into a DATAPLOT command. For example,
Although in this example we could have simply entered the string directly in the title, this capability can be useful in writing general purpose macros and within loops.
where <sout> is the name of the string;
and <sin> is an expression that defines the contents of the string.
let string s1 = Title for Plot One let string s2 = Title for Plot Two let string s3 = Title for Plot Three loop for k = 1 1 3 title ^s^k plot y^k x end of loopNote:
. Assume we have variables X and Y in the files "file1.dat" to . "file10.dat" and we want to plot each of these in turn. . LET STRING S1 = file LET STRING S3 = .dat TITLE CASE ASIS LOOP FOR K = 1 1 10 LET STRING S2 = ^K LET STRING FNAME = ^S1&^S2&^S3 READ ^FNAME Y X TITLE Data from File ^SOUT PLOT Y X DELETE Y X END OF LOOP
Date created: 12/4/2008