From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-04-2015 04:46 AM
Hi all,
got an Problem with "Find"
I wanna create an application that works as moving average.
So I take the Arith. Mean from 30 Blocks
zaeler1 = zaeler1+1 zaeler2 = zaeler2+1 statsel(6) = "Yes" Call StatBlockCalc( "Block" , zaeler1 & "-" & zaeler2 , "[" & ChannelNr & "]/I_" & pruefling & "\15") arithmean = StatArithMean
then I add an offset as limit (here upper limit)
sum = ioben + arithmean
then I wanna find the measurement that doesnt fit.
intmyresult = Find("Ch(""[" & ChannelNr & "]/I_" & Example & "\15"")>" & (arithmean) & "",morefail )
but the line with fin produce an Error.:
"
FIND("Ch("[1]/I_4812\15")>1,415"",2) fehlende rechte Klammer ")".
"
I use Diadem 14.0
Has anyone an Idea ?
Thank you
Michael
Solved! Go to Solution.
11-04-2015 08:19 AM
Hi Michael,
Debugging Calculate and Find expressions is the worst thing about using them, so I always try to make the expressions look as simple as possible. One great way to do that is to separate the channel expression from the Calculate or Find expression by assigning it to a T1, T2, T3 variable, like this:
T1 = "[" & ChannelNr & "]/I_" & Example & "\15" intmyresult = Find("Ch(T1)>" & arithmean, morefail)
I also removed the parentheses around the arithmean variable-- in VBScript enclosing a variable in parentheses often subtype-casts it to a boolean, which I doubt you want. Anyway, the "&" string concatenation operator automatically subtype-casts the arithmean variable to a string in order to perform the concatenation, so you don't need the parentheses.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-05-2015 02:48 AM
Hi Michael,
Brad is right that it is hard to debug convoluted formulas, but I would like to give it a try
intmyresult = Find("Ch(""[" & ChannelNr & "]/I_" & Example & "\15"")>" & (arithmean) & "",morefail )
I suppose you are in DIAdem SCRIPT and not in the calculator? If so I think your conversion of "arithmean" is incorrect (in case you have a German Windows localization):
What happens if you write?:
Call Msgbox(arithmean)
For me the output is:
1,415 ' comma!
Is it the same for you too?
If so, your string has an additional comma and is incorrectly interpreted by FIND.
Please try to write:
Str(arithmean)
instead of
(arithmean)
Hope that helps you along!
Best regards,
Christoph
11-05-2015 03:15 AM
Wow,
It works,.
Thanks a lot!!!
11-05-2015 03:34 AM
You are welcome! Thanks for the feeback.