how to dim a dimension constant for a program for CR1000_Campbellsci论坛问答

Hi,

I am actually trying to write a program for the logger CR1000 for reading several light sensors. each light sensor has it is own multiplier. So I need to include (if that is possible)a dimension constant (like multi(x)). I wrote a piece of script, and would be gratefull if some one is able to see whether that is right or need to be modified.

how to dim a dimension constant for a program for CR1000_Campbellsci论坛问答


Dim cal(15)
const cal(1)= 53.9
const cal(2)= 53.8
const cal(3)= 54.6
const cal(4)= 53.2
const cal(5)= 53.6
const cal(6)= 56.6
const cal(7)= 53.9
const cal(8)= 57.6
const cal(9)= 54.6
const cal(10)= 53.6
const cal(11)= 53.5
const cal(12)= 53.6
const cal(13)= 57.6
const cal(14)= 53.1
const cal(15)= 53.6


so the question is whether this constant can be called within the program using: cal(2) , for example.
Thanks in advance

* Last updated by: beech on 4/22/2010 @ 6:24 PM *

新对话如下:

In CRBasic, a Variable is one type of program element and a Constant is another. The code you have written above will not compile.

You can initialize a variable (assign it a value), similar to what you have done above, but removing the Const declaration (e.g., cal(1) = 53.9)

In newer operating systems, you can also initialize the entire array on one line, e.g.,

Dim Cal(15) = {53.9, 53.8, 54.6, 53.2....etc}

Regards,

Dana

分享到:

原文链接:,转发请注明来源!
海洋仪器网 仪器使用 how to dim a dimension constant for a program for CR1000_Campbellsci论坛问答
「how to dim a dimension constant for a program for CR1000_Campbellsci论坛问答」评论列表

发表评论