DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Statistical dispersion of repetitive action

Hi Esber,

 

Your VBScript syntax is off.  You look like you want to refer to a channel in the Data Portal, but you do so with an explicit string constant, like "[1] PB2 Sm100".  Instead create a channel object variable and use that to read and write values from/to that channel, like this:

Dim a, n, aMax, ChannelA, ChannelB, ValA, ValB
Set ChannelA = Data.GetChannel("[1]/PB2 Sm100")
Set ChannelB = Data.GetChannel("[1]/PA22 Sm100")
aMax = ChannelA.Size
FOR a = 1 TO aMax
  ValA = ChannelA(a)
  ValB = ChannelB(a)
  IF ValA < ValB THEN
    n = n + 1
    ChannelA(a) = ValB
  END IF
NEXT

Brad

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 11 of 12
(363 Views)

Hi Esber,

 

What version of DIAdem are you using?  The ChnEventCopyValues() command was apparently released after your DIAdem version.  Replace that one command line with the following two, and it should work for you:

    Call DataBlCopy(RawXChannel, P1, Pn-P1+1, CycXChannel, 1)
    Call DataBlCopy(RawYChannel, P1, Pn-P1+1, CycYChannel, 1)

I was able to reproduce the error you described in DIAdem 2015, and making this substitution allowed the script to finish the cycle extraction.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 12 of 12
(348 Views)