Topic
Creating an Array
- This topic has 5 replies and 2 voices and was last updated 21 years ago ago by Cayouettem@bowater.com.
-
AuthorPosts
-
07.05.2004 at 02:42 #33390Cayouettem@bowater.comParticipant
I’m writing a function script and I was wondering how i could create an array. I am going to return that array to be plotted. Here is the code below; the variable ‘F’ should be the array for each sample taken by the variable ‘A WI soularr(v)’.
thanks,
Mathieu
CODE:
[code]
Dim F,G,H
Dim c
c = 0
For Each Value c In ‘A WI soularr(v)’ do
If (‘A WI soularr(v)’.Y[c] < 23) Then
F = 1
Else
F=0
End
Endreturn F
[/code]07.05.2004 at 03:16 #33386Bernhard KantzParticipantInitialize the result variable F with the [b]# operator[/b] which multiplies a value by a given number. The [b]NumberOfValues[/b] function determines the number of values of the result dataset.
[code]
Dim F,G,H
Dim c
c = 0
F = 0s # NumberOfValues(‘A WI soularr(v)’)For Each Value c In ‘A WI soularr(v)’ do
If (‘A WI soularr(v)’.Y[c] < 23) Then
F[c] = 1
End
End
return F
[/code]
Support
support@weisang.com07.05.2004 at 03:38 #33387Bernhard KantzParticipant… there is of course a much faster alternative:
[code]
Dim F
F = 0 # NumberOfValues(Signal)
F[ValuesAboveLevel(Signal, 23, EVENT_INDEX + EVENT_COMPLEMENT)] = 1
F
[/code]
This code initializes the array with zeros and then uses an indexed assignment to set the values, where the event occures, to 1.… even less code, you need when using the Trigger function:
[code]
1 – Integer32 Trigger(Signal, 23, 23)
[/code]
support@weisang.com07.05.2004 at 06:44 #33388Cayouettem@bowater.comParticipantTried using the faster approach because it other one was jamming my computer, but i’m getting a syntax error. Any ideas why?
Mathieu
Dim F,G,H
Dim cc = 0
F = 0 # NumberOfValues(‘A WI soularr(v)’)
F[ValuesAboveLevel(‘A WI soularr(v)’, 23, EVENT_INDEX + EVENT_COMPLEMENT)] = 1return F
13.05.2004 at 01:06 #33385Cayouettem@bowater.comParticipantI’m writing a function script and I was wondering how i could create an array. I am going to return that array to be plotted. Here is the code below; the variable ‘F’ should be the array for each sample taken by the variable ‘A WI soularr(v)’.
thanks,
Mathieu
CODE:
[code]
Dim F,G,H
Dim c
c = 0
For Each Value c In ‘A WI soularr(v)’ do
If (‘A WI soularr(v)’.Y[c] < 23) Then F = 1 Else F=0 End End return F [/code]13.05.2004 at 01:06 #33389Bernhard KantzParticipantYour code runs perfectly on our test machine.
Please make sure that you do not have a syntax error in ‘A WI soularr(v)’.
If your problem persists, please send us an example database to support@weisang.com along with the exact version number of your FlexPro installation 6.0.xx which you can find in ?=>About FlexPro… -
AuthorPosts
- You must be logged in to reply to this topic.