Campbell-scientific CR1000 Measurement and Control System Manual de usuario Pagina 117

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 588
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 116
Section 7. Installation
117
In this example, a For/Next structure with a changing variable is used to specify
which elements of the array will have the logical operation applied to them. The
CRBasic For/Next function will only operate on array elements that are clearly
specified and ignore the rest. If an array element is not specifically referenced,
e.g., TempC(), CRBasic references only the first element of the array, TempC(1).
CRBasicExample7. UsingaVariableArrayinCalculations
Public TempC(4)
Public TempF(4)
Dim T
BeginProg
Scan(1,Sec,0,0)
Therm107(TempC(),4,1,Vx1,0,250,1.0,0)
For T = 1 To 4
TempF(T) = TempC(T) * 1.8 + 32
Next T
NextScan
EndProg
Dimensions
Some applications require multi-dimension arrays. Array dimensions are
analogous to spatial dimensions (distance, area, and volume). A single-dimension
array, declared as VariableName(x), with (x) being the index, denotes x number
of variables as a series. A two-dimensional array, declared as
Public (or Dim) 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 (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.
When using variables in place of integers as the dimension indices, e.g., CRBasic
example Using variable array dimension indices
(p. 117), declaring the indices As
Long variables is recommended as doing so allows for more efficient use of
CR1000 resources.
CRBasicExample8. UsingVariableArrayDimensionIndices
Dim aaa As Long
Dim bbb As Long
Dim ccc As Long
Public VariableName(4,4,4) As Float
Vista de pagina 116
1 2 ... 112 113 114 115 116 117 118 119 120 121 122 ... 587 588

Comentarios a estos manuales

Sin comentarios