DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

creating an excel concatenated if statement in diadem calculator

I am trying to create an equilivant to excel's 'concatenated if' function in diadem which will check a value of either 0,1,2 in one existing channel and apply a conversion of divide by 1,10 or 100 to another existing channel and creating a new channel with the resulting data.
Any help would be appreciated.
0 Kudos
Message 1 of 7
(3,927 Views)

Hello Adek!

The generic approach looks like this:

Call ChnCalculate("Ch(""Result"") = Ch(""Values"") / Array(1,10,100)(Ch(""Index""))")

Assuming 'Values' is your values channel name and 'index' is the index channel name with the 0/1/2 values.

If it is just the calculation you described you can also use a little bit mathematics:

Call ChnCalculate("Ch(""Result2"") = Ch(""Values"") / 10^(Ch(""Index""))")

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 7
(3,924 Views)

Hello Matthias,

Thanks for the information, just to confirm, the excel function I am trying to replicate is :

Cell C2 =IF(Cell A2=0,Cell B2/1,IF(Cell A2=1,Cell B2/10,IF(Cell A2=2,Cell B2/100,Cell B2)))

Repeated for the whole channel length.

Therefore two channels A and B with the data and a new created channel C which is the result of the function

Maybe more of a nested function than concatenated perhaps.

Will your solution give me this result ?

Thanks

Ade

0 Kudos
Message 3 of 7
(3,918 Views)
Hello Ade!
 
The ChnCalculate will do the calculation for the whole channels. Just give it a try: Make some short channels and run the command. You will seeSmiley Happy
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 4 of 7
(3,916 Views)

Thanks Matthias,

I will give it a try.

Ade

0 Kudos
Message 5 of 7
(3,913 Views)

Hi adek (and others),

Just a quick note for the future.  R&D is actively working on making exactly this Excel IF() use case easier in the Channel Calculator.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 7
(3,904 Views)

Hi Brad,

Thanks for the info, I'm sure it will be a welcome addition to the diadem tools for many users.

Regards

Ade

0 Kudos
Message 7 of 7
(3,900 Views)