LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Node cannot use "fabs"? Anyone can help me?

Solved!
Go to solution

I want to use "fabs" in the formula node, but it appears the "undefined variable" information, showed in the following picture. Does anyone know how to solve it? Thanks a lot!

Download All
0 Kudos
Message 1 of 14
(3,463 Views)

What is "fabs" supposed to mean?

 

It looks like you have it set up as a function.  But that is not a valid function name.  Search LabVIEW help for "formula node syntax".  That help file will show you the functions that are valid in a formula node.

0 Kudos
Message 2 of 14
(3,452 Views)

The fabs function doesn't work in the formula node, you only can use abs().

 

http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/formula_node_and_express/

 

Regards

0 Kudos
Message 3 of 14
(3,450 Views)

But if I use "abs", it will lose accuracy for my data. And this manual says that labview support "fabs", check the attachment.

0 Kudos
Message 4 of 14
(3,444 Views)

Which manual is this?

0 Kudos
Message 5 of 14
(3,433 Views)

OK, found it. These are part of the manager functions. This has nothing to do with formula nodes.

 

(see also)

0 Kudos
Message 6 of 14
(3,432 Views)

@xiaoquan wrote:

But if I use "abs", it will lose accuracy for my data.


Why? Have you actually tried?

 

According some casual testing, abs() works just fine on DBLs and returns the absolute value of the DBL as another DBL. (for example with an input of a= -5e99, abs(a)=5e99).

0 Kudos
Message 7 of 14
(3,428 Views)

Yes, I tried.  It can be accurate to six decimal places.  I tink  maybe it is the limit of DBL. Do you know some other way to increase the accuracy? Thank you very much!

0 Kudos
Message 8 of 14
(3,423 Views)

maybe with some code, "if else". Not elegant but functionally

0 Kudos
Message 9 of 14
(3,411 Views)
Solution
Accepted by xiaoquan

@xiaoquan wrote:

Yes, I tried.  It can be accurate to six decimal places.  I tink  maybe it is the limit of DBL. Do you know some other way to increase the accuracy? Thank you very much!



That is simply not true! Make sure you change the display format of the indicator to show enough digits.

(right-click...display format...)

 

 

(If you still have problems, please attach your code with some typical data.)

Message 10 of 14
(3,410 Views)