03-02-2016 07:33 AM
Hi all,
I am using the following command to calculate the log of a numeric channel:
Call Calculate ("Ch(""Group2/Result"")= Lg (Ch(""Group1/Input""))")
I need to do this calculaiton for all my 20 channels. My quesiton is, is it possible to specify a variable name instead of Group2/Result and Group1/Input, say "P" & Counter where counter is from 1 to 20?
Regards,
Josef
Solved! Go to Solution.
03-02-2016 12:17 PM
Hi josef,
I prefer to use the newer object variables and symbol and channel arrays to tackle this task:
Set Group1 = Data.Root.ChannelGroups("Group1") Set Group2 = Data.Root.ChannelGroups("Group2") jMax = Group1.Channels.Count ' = 20 Formula = "Chan2 = Lg(Chan1)" Symbols = Array("Chan1", "Chan2") FOR j = 1 TO jMax Set Channel1 = Group1.Channels(j) Set Channel2 = Group2.Channels(j) Channels = Array(Channel1, Channel2) Call Calculate(Formula, Symbols, Channels) NEXT ' j
Brad Turpin
DIAdem Poduct Support Engineer
National Instrumetns
03-03-2016 03:24 AM
Thanks Brad, it works well!
Regards,
Josef
02-08-2017 04:53 PM
Can I also apply the log to a channel this through the 'Analysis' tab in DIAdem? Or will I need to write a script?
Thanks,
Z
02-10-2017 10:44 AM
Hi Z,
You can run a logarithmic curve fit in the "Approximate" dialog in ANALYSIS. If you just want to calculate the Log or Ln of all the values of a channel, then you need to use the Channel Calculator. The script above shows how to invoke the Channel Calculator programmatically, but you could instead pop up the Channel Calculator dialog yourself and run the logarithm calculation interactively.
Brad Turpin
DIAdem Product Support Engineer
National Instruments