02-12-2020 09:35 AM
Hi,
The following line of code will soon fail once ChnValMax disappears having become obsolete:
Dim HWChn: HWChn = "[1]/HW Angle"
L1 = Find("Ch(""" & HWChn & """) = ChnValMax(""" & HWChn & """)")
To find the maximum values of a channel the help files instruct me to use something like:
Data.Root.ChannelGroups(1).Channels(2).Maximum
This seems terribly long-winded, and since I'm going to refer to the same channel frequently, I have tried to assign a channel to a variable using GetChannel (the first line of code is dummy just to make the point):
T1 = "[1]/HW Angle"
Set HWChn = Data.GetChannel(T1)
Having implemented this I found the following code works fine:
L1 = Find("Ch(""" & T1 & """) = " & HWChn.Maximum)
But, can I do better? The use of T1 and all the quotations marks is ugly, so can I use the variable HWChn for the channel reference in the first part of my Find condition?
Thanks, Simon.
Solved! Go to Solution.
02-14-2020 03:42 PM
Hi All,
I believe I answered a similar question in the following sibling post:
https://forums.ni.com/t5/DIAdem/Channel-references-in-functions/m-p/4014309#M27160
Brad Turpin
Senior Technical Support Engineer
National Instruments