3 dimensions, 4 data types – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 140

Section 4. CRBasic – Native Language Programming
4.2.4.3 Dimensions
Occasionally, a multi-dimensioned array is required for an application.
Dimensioned arrays can be thought of just as length, area, and volume
measurements are thought of. A single dimensioned array, declared as
VariableName(x), with (x) being the index, can be thought of as x number of
variables is a series. The array can be declared using either a Public or a Dim
instruction. A two-dimensional array, declared as
Public VariableName(x,y), or
Dim VariableName(x,y),
with (x,y) being the indices, can be thought of as (x) * (y) number of variables
in a square x-by-y matrix. Three-dimensional arrays (VariableName (x,y,z),
(x,y,z) being the indices) have (x) * (y) * (z) number of variables in a cubic x-
by-y-by-z matrix. Dimensions greater than three are not permitted by
CRBASIC. Strings can be declared at a maximum of two dimensions. The
third dimension is used internally for accessing characters within a string.
When using variables in place of integers as the dimension indices, as shown in
Example 4.2.4-2, declaring the indices as Long variables is recommended as
doing so allows for much more efficient use of CR9000X resources.
EXAMPLE 4.2.4-2. Using Variable Array Dimension Indices
Dim aaa As Long
Dim bbb As Long
Dim ccc As Long
Public VariableName(4,4,4) as Float
BeginProg
aaa = 3
:
bbb = 2
:
ccc = 4
Scan()
VariableName(aaa,bbb,ccc) = 2.718
NextScan
EndProg
4.2.4.4 Data Types
The declaration of variables (via the DIM or the PUBLIC statement) allow an
optional type descriptor AS that specifies the data type. The default data type,
without a descriptor, is IEEE4 floating point (FLOAT). The four declared data
types are FLOAT, LONG, BOOLEAN, and STRING. Stored data has
additional data type options FP2, UINT2, BOOL8, and NSEC. Table 4.2.4-1
lists details for the available data types for both variable declaration format as
well as data storage format. The data type for data storage is determined by a
parameter in the output processing instructions. Example:
Sample (Reps, Variable, FP2)
4-12