From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Node Error

I am entering this formula :

 

 

z = -10*log((10**((x)/10))-(10**(-(y)/10))); in the formula node.  An error is displayed. Error on line 1 is marked by a '#' character: "... = -10*log((10**((x)#/10))-(10**(-(y)/10"    Formula node: array indexing expected. Did not get it. Please provide me with a solution

Snip.PNG

 

 

 

0 Kudos
Message 1 of 7
(2,964 Views)

Hi Chhavi,

 

Did not get it.

So you wire an array to your formula node - and don't get the error ""array indexing expected"?

 

Why use a formula node at all?

check.png

Because of famous polymorphism you can easily replace the controls/indicators by arrays…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(2,950 Views)

A for loop around the expression node would work too.

 

Indeed, no reason for the FN...

0 Kudos
Message 3 of 7
(2,901 Views)


 

You can process arrays in the formula node, but it's quite a hassle

 

2019-07-16_141319_formula_primitives.png

0 Kudos
Message 4 of 7
(2,890 Views)

I abhor the formula node for the simple reason that you have no chance for syntax error using native math primitives instead.  (My typing is, well... bad.)  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 7
(2,849 Views)

I do like expression nodes for simple scaling, like going from mm to m and vice versa.

 

A typical bug with the formula node and expression node is related to the fact that we use commas as separators over here. And when you use a number with a comma, you can get a valid expression, but not a valid result:

 

y=x*12,34;

 

This results in y=12 for x=1, not y=12,34! 

 

0 Kudos
Message 6 of 7
(2,829 Views)

Moreover, you can't inline a subvi, which has an expression node or formula node within

 

that's the main reason we use those structures only for prototyping

here's my favorite: 

http://zone.ni.com/reference/en-XX/help/371361R-01/lvinstio/degrees_to_radians/

0 Kudos
Message 7 of 7
(2,824 Views)