LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combining formula node and arrays for calculation

Hello all!

 

I have two arrays containing values defined by me. Each value of respective column and row index shall be used in a formula to calculate the new value for the respective column and row, to build a new array for further use. This shall be done several times during a simulation with variable function parameters.

 

I am aware that I should probably use a for loop for this calculation, but I am curious to how I should build such a procedure.

 

Any ideas? Smiley Happy

0 Kudos
Message 1 of 3
(2,376 Views)

Hi Euler123,

 

Let's say that you have an array of fix size and with values in it. Then you'll need to use auto indexing at the beginning of each for loop input tunnel (usually it is by default for for loops) as shown below:

Capture.JPG

In the first iteration of the other for loop, it will take the first row values [1, 2, 3] and pass it to the inner for loop (unless you want to extract the values for each column, transpose that 2D array before connecting it to the outer for loop). In the inner for loop, it will execute 3 times and each iteration it will extract each element from the array obtained from the outer for loop. 

 

To build the new array, it's just the opposite. Pass the element out from the for loop and instead of getting a last value tunnel, you'll get an auto indexing tunnel (default for for loops).

 

Anyways, you'll need to get some basic understanding on LabVIEW first. Here's some tutorials to aid you on understanding For Loops.

http://www.youtube.com/watch?v=ziOnPNJgeVg

 

 

Here's some additional notes which might help you:
http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/auto_indexing_1/

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/auto_indexing_1/

http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/auto_indexing_1/

 

Play around with For Loops and use something to slow the execution down like Highlight Execution which allows you to see what is going on. Else, take up some LabVIEW courses 😉

 

Warmest regards,

Lennard.C

Learning new things everyday...
Message 2 of 3
(2,341 Views)

Thank youSmiley Happy

0 Kudos
Message 3 of 3
(2,305 Views)