Indexing an Array Into a Formula Node

Updated Dec 12, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have an array that I want to send into a LabVIEW Formula Node one element at a time. Unfortunately, the Formula Node expects a single value and not an array. Is there any way I can index the array into the Formula Node?

Solution

You need to access the array from within the Formula Node. For example, you could use the following code in the Formula Node to access the array. Refer to the snippet below for an example of accessing an array in a Formula Node.
int32 i, j, n;
float64 x;
n = sizeOfDim(a, 0) - 1;

do {
     i = 0;
     for (j=0; j<n; j++)
          if (a[j] > a[j+1]) {
               x = a[j];
               a[j] = a[j+1];
               a[j+1] = x;
               i = 1;
          }
} while (i);