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.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

chn combobox how to get channel selection for script and calculations

Solved!
Go to solution

hi, my mother languaje is spanish and i'm very confused 

the user dialog box what it should be doing is that i could choose from two chn combo boxes 2 angles data from which i want to calculate the difference.

 

 

 

tl:dr i want to select 2 angles and  Call Calculate("Ch(""ANS"") = (Ch(""L1(1,1))"") -(Ch(""L1(1,2)""))

 

this is by far my script in the user dialog box

 

'advierte de cambio de variable En ANGLE1

Sub ChnComboBox1_EventChange(ByRef This) 'Created Event Handler
Call MsgBoxDisp("Selected channel: " & ChnComboBox1.Text)
End Sub
'advierte de cambio de variable En ANGLE2
Sub ChnComboBox2_EventChange(ByRef This) 'Created Event Handler
Call MsgBoxDisp("Selected channel: " & ChnComboBox2.Text)
End Sub
'PLOTS
Sub Button1_EventClick(ByRef This) 'Created Event Handler
Call Calculate("Ch(""Result5"") = (Ch(""L1(1,1))"") -(Ch(""L1(1,2)""))
End Sub

 

had a lot of trouble with examples please help any advice will suffice

Download All
0 Kudos
Message 1 of 5
(6,006 Views)
Solution
Accepted by JohnnyNoxville

Hi Johnny,

 

As long as you have a reasonably new DIAdem version, you should be able to use the built-in subtraction function from the ANALYSIS panel instead of the channel calculator, like this:

 

Call ChnSub(ChnComboBox1.Text, ChnComboBox2.Text, "Result5")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 2 of 5
(5,943 Views)

thanks that did the job

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

what will be the result channel's frequency after subtraction, if both parameter  channels have different sampling rate?

 

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

Hi Sovarian,

 

Most ANALYSIS functions in DIAdem that use multiple input channels assume that the channels are the same length and run the calculation row-by-row across the input channels.  So you'd need to row-align the channels you want to subtract first before running the subtraction calculation.  In all versions of DIAdem you can use the ANALYSIS function "Linear Mapping", and in newer DIAdem versions there is a "Resampling" function you could also use.

 

Brad Turpin

Senior Technical Support Engineer

National Instruments

0 Kudos
Message 5 of 5
(2,149 Views)