![]() |
MACRO SUBSTITUTION CHARACTERName:
To pass arguments to a macro, do something like
Up tp 10 arguments may be passed (although limits on command line lengths still apply). Arguments containing spaces or hyphens should be enclosed in quotes. The character limit for a single argument is 40 characters. In the SAMPLE.DP macro, if a $1 is encountered, it will be replaced with "arg1", if a $2 is encountered, it will be replaced with "arg2" and so on. A $0 will substitute the number of arguments given on the CALL command. This substitution will only occur if a command line is contained within a macro (i.e., if no macro is active, the "$" will not signal any substitution and it will remain in the command line as given). Dataplot currently only supports one level of argument substitition for macros. That is, the values of the macro arguments (i.e., the $1, $2, etc.) will contain the values given by the most recent CALL command that specified at least one argument. If you need to nest CALL commands with macro arguments, the recommended work around is to have the higher level macro extract any macro arguments passed to it into temporary variables or strings before calling any other macros. For example, supposse SAMPLE.DP needs to call SAMPLE2.DP with arguments. You could do something like the following in SAMPLE.DP:
let string zzzzs1 = $1 let string zzzzs2 = $2 let string zzzzs3 = $3 ... call sample2.dp newarg1 newarg2 The default character for argument substitution is the "$". To use a different character, enter the command The MACRO SUBSTITUTION CHARACTER command allows you to specify a character other than "$" to signify argument substitution.
where <char> is the character to use as the macro substitution character.
MACRO SUBSTITUTION CHARACTER $
MACRO SUBSTITUTION CHARACTER @ LET Y = NORMAL RAND NUMBERS FOR I = 1 1 100 CALL HIST.DP "Title for Sample Plot" Ywhere HIST.DP contains the lines TITLE @1 HISTOGRAM @2
|
Privacy
Policy/Security Notice
NIST is an agency of the U.S.
Commerce Department.
Date created: 12/05/2005 |