Variables, Substitution, and Assignment › NCL Table Manipulation
NCL Table Manipulation
The discussion of variables and substitution has so far concentrated on using simple and complex variables as single data entities. You can also construct tables of data using multiple individual variables using either of two common techniques:
- You can use complex variables, for example, &DATA&INDEX where the variable &INDEX contains a number (for example, 1,2,3), so generating variable names of &DATA1, &DATA2, &DATA3, and so on.
This technique is fairly efficient for small tables, but the overheads of creating and managing large numbers of variables become significant when dealing with large tables. However, it is only suitable for numeric table indexes, or short alphanumeric indexes that do not contain any characters that are invalid in an NCL variable name.
- The second technique uses the complex variable approach described previously, but each entry in the table is represented by 2 (or more) variables (for example, &KEY&INDEX, and &DATA&INDEX). One contains the key value, and the others the data values. The table is searched by incrementing an index variable, and comparing the key variable to the search value. When a match is obtained, the index variable is used to build the complex variable name containing the data.
|
Copyright © 2010 CA.
All rights reserved.
|
|