DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Logarithm calculation

Solved!
Go to solution

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

0 Kudos
Message 1 of 5
(4,314 Views)
Solution
Accepted by topic author jcamilleri

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

0 Kudos
Message 2 of 5
(4,301 Views)

Thanks Brad, it works well!

 

Regards,

Josef

0 Kudos
Message 3 of 5
(4,282 Views)

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

0 Kudos
Message 4 of 5
(3,199 Views)

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

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