DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

if less than replace with no value or zero

I'm trying to use the diadem calculator to create the equivalent of a 'if less than 4.0 replace with no value or 0' for the complete cell count of a named channel . Either create a new channel for the result or replace the old values

thanks

AdeK 

0 Kudos
Message 1 of 6
(5,849 Views)

Hi Adek

 

There is an "Procedure" in the help that describes exactly what you want. The formula is:

 

Ch("Group2/Result") = Ch("Group1/Input")+CTNV(Ch("Group1/Input")<4)

 

 

 

For explanations see the help tree under "Procedures>Mathematics>Eliminating Outliers Using NoValues"

 

Hope this helps.

 

Winfried

Message 2 of 6
(5,841 Views)

Hi Winfried,

Thanks for the advice, I searched the forum instead of looking in the help....my mistake !

I will first search the standard help in future .

 

Regards

AdeK

0 Kudos
Message 3 of 6
(5,837 Views)

Hi Winfried,

It's not quite the solution i need.

I want to turn a noisy analogue signal into a digital state plot therefore if <5V substitute a 0, if >5V substitute a 1- if this can be acheived using the Diadem calculator in one operation, this would be useful.

Regards

AdeK

0 Kudos
Message 4 of 6
(5,795 Views)

Hello Adek!

 

The IIF command is the solution for you task. Try this expression:

 

Ch("Result")=IIf( Ch("Input")>=5,1,0)

From my experience you have to filter or smooth the input singal in front of the calculation to get a good result. This depdends on how 'noisy' the signal realy is.

 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 5 of 6
(5,789 Views)

Hi Adek,

 

Twigeater is absolutely right, as always, and he's pointed you to the most recent and syntax-friendly option available in DIAdem 11.0 and later.

 

If you are using an older version of DIAdem, or if you're manipulating very large channels, I'd recommend using the old "FormulaCalc()" function, which is faster for numeric channels and has a boolean construction that automatically resolves to 0 or 1, corresponding nicely to what you want.  Here's the code:

 

R1 = 0.2

L1 = CNo("Noise data/Noise_1")

Call FormulaCalc("Ch(L1):= (Ch(L1)>R1)")

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 6
(5,778 Views)