LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Computing arrays using formula nodes


@kozuka32 wrote:

As shown in the attached file, only the second line is calculated. Could you also teach me how to modify the vi program?

kozuka32_0-1698392245647.png


my biggest issue with the formula node is, that you can initialize an array from within the formula node, but you can't use variables to do that, you need numeric constants to represnt the number of rows or columns. try it yourself. float Y[i][j]; will break your .vi

 

also the formula node function  sizeOfDim will break the .vi, if used as a replacement for i or j

 

alexderjuengere_0-1698664457126.png

that is why I have to initialize arrays outside the formula node- if somebody knows an alternative feel free to post your konwledge.

in response to your original post, this would be my formula node alternative:

 

Spoiler
2d-formula-node.png

If I where you, try to avoid the formula nodes if possible - it can be used for quick prototyping, but in deployed code, you want to get rid of it especially as subvis with formula nodes can not be inlined.

 

0 Kudos
Message 11 of 14
(323 Views)

@alexderjuengere wrote:

@kozuka32 wrote:

As shown in the attached file, only the second line is calculated. Could you also teach me how to modify the vi program?

kozuka32_0-1698392245647.png


my biggest issue with the formula node is, that you can initialize an array from within the formula node, but you can't use variables to do that, you need numeric constants to represnt the number of rows or columns. try it yourself. float Y[i][j]; will break your .vi

 

also the formula node function  sizeOfDim will break the .vi, if used as a replacement for i or j

 

alexderjuengere_0-1698664457126.png

that is why I have to initialize arrays outside the formula node- if somebody knows an alternative feel free to post your konwledge.

in response to your original post, this would be my formula node alternative:

 

Spoiler
2d-formula-node.png

If I where you, try to avoid the formula nodes if possible - it can be used for quick prototyping, but in deployed code, you want to get rid of it especially as subvis with formula nodes can not be inlined.

 


And if recent benchmarking is accurate, it could be orders of magnitude slower than native code.

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 12 of 14
(304 Views)

Thank you for your detailed explanation. I would like to use it as a reference and try it out right away. I'm sure there are some things I don't understand, so please feel free to let me know. thank you.

0 Kudos
Message 13 of 14
(278 Views)

@billko wrote:

And if recent benchmarking is accurate,  it [formula nodes] could be orders of magnitude slower than native code.


yes, I can confirm that

Message 14 of 14
(238 Views)