Section 7. Installation
7.8.4.3.2 Dimensioning Numeric Variables
Some applications require multi-dimension arrays. Array dimensions are
analogous to spatial dimensions (distance, area, and volume). A single-dimension
array, declared as,
Public VariableName(x)
with (x) being the index, denotes
x
number of variables as a series.
A two-dimensional array, declared as,
Public VariableName(x,y)
with (x,y) being the indices, denotes (
x
•
y
) number of variables in a square x-by-y
matrix.
Three-dimensional arrays, declared as
Public VariableName (x,y,z)
with (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.
When using variables in place of integers as dimension indices (see CRBasic
example
Using variable array dimension indices
(p. 134))
, declaring the indices
As
Long
variables is recommended. Doing so allows for more efficient use of
CR1000 resources.
CRBasic Example 4.
Using Variable Array Dimension Indices
'This program example demonstrates the use of dimension indices in arrays. The variable
'VariableName is declared with three dimensions with 4 in each index. This indicates the
'array has means it has 64 elements. Element 24 is loaded with the value 2.718.
'
Dim
aaa
As Long
Dim
bbb
As Long
Dim
ccc
As Long
Public
VariableName(4,4,4)
As Float
BeginProg
Scan
(1,sec,0,0)
aaa = 3
bbb = 2
ccc = 4
VariableName(aaa,bbb,ccc) = 2.718
NextScan
EndProg
7.8.4.3.3 Dimensioning String Variables
Strings can be declared to a maximum of two dimensions. The third "dimension"
is used for accessing characters within a string. See
String Operations
(p. 282).
String length can also be declared. See the table
Data Types in Variable Memory.
(p. 131,
p. 130)
A one-dimension string array called
StringVar
, with five elements in the array
and each element with a length of 36 characters, is declared as
Public
StringVar(5)
As String
* 36
134
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......