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: 

Generate a Worst Case (max) Channel from 2 or more channels

Solved!
Go to solution

Hi,

 

I'm creating a script to process a range of data channels, what is the easiest way to combine two channels (or more) in a way that the maximuim values are preserved in the result channel

 

eg

Channel 1     Channel 2      Results Channel

1                          5                       5

2                          6                       6

3                          1                       3

4                          2                       4

5                          5                       5

 

I'm currently using DIAdem 2019 64bit

0 Kudos
Message 1 of 3
(2,050 Views)
Solution
Accepted by topic author KBramley

Hey KBramley,

 

I'm no Diadem expert but would using the Channel Event Search (Free Formula) work for you?

 

ChnEventResultList = ChnEventFind("A>B", Array("A","B"), Array(Data.GetChannel("[1]/Data"),Data.GetChannel("[2]/Data")))
Call ChnEventCreateFilteredChn("/Results", ChnEventResultList, "[2]/Data", "[1]/Data")

 

Here I am comparing 2 data sets, and if A > B I replace the data in the results with the corresponding data from B.

 

(I set this up using the GUI and then used ctrl+shift+c to copy the formula to my clipboard.)

 

Hope that helps.


Best,

Jelmer

0 Kudos
Message 2 of 3
(1,992 Views)

Thanks Jelmer that has worked perfectly Smiley Happy

 

Best Regards

 

Kbramley

 

0 Kudos
Message 3 of 3
(1,971 Views)