DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

text channel values change detection

Solved!
Go to solution

Hi, I have a text channel, channel length is more than 10,000.

Whenever the value in this channel changes, I need to detect and find out index.

I can loop through the channel and compare if the channel is short. Any better ways to do this?

 

Thank you.

 

0 Kudos
Message 1 of 5
(3,800 Views)

Hi IIx,

 

Using the ChnFind() command in a loop will perform much faster than accessing each channel value individually in a VBScript loop.  If you have trouble figuring this out, please post an example data set with such a text channel in it.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

0 Kudos
Message 2 of 5
(3,783 Views)

Hi Brad,

 

Thank you for you response. I was tring to use the combination of chnfind() and strcomp().

However, I can't get the syntax correct. Here is what I did:

 

Str1  = "test" -- Str1 is a constant string

Str2 = cht(1,"Group1/Channel1") --  Str2 is as string value from a channel.

Str2 = "What"

startIndex = 200

Indexfind = chnfind("strcomp(Str1,Str2)<>0", startIndex)

 

The script runs, no error message, it won't find corrext index either. Please help.

 

Thank you very much.

 

0 Kudos
Message 3 of 5
(3,758 Views)
Solution
Accepted by topic author llx

Hi IIx,

 

The ChnFind expression can only reference global DIAdem variables.  So you either need to GlobalDim() your "Str2" variable or just use one of the existing temporary T1, T2... variables.  Also, you want to refer to the entire channel in the expression, not just one of the channel's values.  The motivation to use ChnFind is so that the search through the channel happens in the function call and not with VBScript primitives.

T1 = "Group1/Channel1"
T2 = "test"
startIndex = 200
Indexfind = ChnFind("Ch(T1) = T2", startIndex)

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 4 of 5
(3,749 Views)

Hi Brad,

 

Thank you for your reply.

It worked this way, only minor changes needed.

 For T2 is a string here,  I need to use cstr(T2) instead of T2 in the chnfind().

0 Kudos
Message 5 of 5
(3,676 Views)