EasyManua.ls Logo

Campbell CR800 Series - Advanced Array Declaration; Using a Variable Array in Calculations

Campbell CR800 Series
598 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Section 7. Installation
135
Using a Variable Array in Calculations
'This program example demonstrates the use of a variable array to reduce code. In this
'example, two variable arrays are used to convert four temperature measurements from
'degree C to degrees F.
Public TempC(4)
Public TempF(4)
Dim T
BeginProg
Scan(1,Sec,0,0)
Therm107(TempC(1),1,1,Vx1,0,250,1.0,0)
Therm107(TempC(2),1,2,Vx1,0,250,1.0,0)
Therm107(TempC(3),1,3,Vx1,0,250,1.0,0)
Therm107(TempC(4),1,4,Vx1,0,250,1.0,0)
For T = 1 To 4
TempF(T) = TempC(T) * 1.8 + 32
Next T
NextScan
EndProg
7.6.3.5.1 Advanced Array Declaration
This section describes syntax that facilitates array filling, scaling, copying, etc.
The main applications are as follows:
a) initiating an array
b) scaling an array, for example converting all of the FREQ/HZ returned by a
group of AVW200's into digits, strain, level, etc.
c) creating boolean arrays based on comparisons with a scalar or another array
The main drivers at the time of starting down this path were
1) multiple years of feedback from customers asking me how to more tersely
initialize and scale arrays - often trying to compare CRBasic to Matlab or Python.
2) Easier ways to scale vibrating wire measurements and transpose their resulting
data arrays:
CRBasic provides an array notation that allows one to easily operate on a single
dimension of an array. Using this notation one can easily:
initialize an array dimension
copy a dimension to a new location
scale an array dimension

Table of Contents

Related product manuals