01-30-2012 01:01 PM
Hi:
Suppose I have a script that finds the maximum values of 10 different spots in a set of data. Each time it finds a new maximum, it saves it to a variable.
How do I combine those 10 variables into a new channel of data? For example:
Row |
Value |
1 |
10 |
2 |
20 |
3 |
30 |
4 |
40 |
5 |
50 |
6 |
60 |
7 |
70 |
8 |
80 |
9 |
90 |
10 |
100 |
01-30-2012 04:22 PM
Hello Gatsby,
Here is some code that will create a new channel and write the value of the variable Peak01_Ch02 into the first row of the newly created data channel.
This code assumes there is at least one channel group in the data portal already.
Dim Peak01_Ch02, ChObj Call Data.Root.ChannelGroups(1).Channels.Add("Channel",DataTypeFloat64,1) Set ChObj = Data.Root.ChannelGroups(1).Channels("Channel") ChObj(1) = Peak01_Ch02
You can easily put the channel object into a loop to fill multiple rows of the channel ...
Hope this helps,
Otmar