08-01-2011 09:30 AM
I haven't had much experience working with arrays in labview and I'm looking for a way to do more complicated math than the "add/multiply array elements."
More specifically, I have a 2-D, 4 row, 3 column matrix ( lets call them x, y, and z, with elements x1, x2, x3, and x4, and the same for y and z.
I need to compute the average for the elements in the 1st and 3rd columns: (x1+z1)/2 = xz1 avg
And then I need to use that result: (xz1 avg - y1)/xz1 avg
For each row in the array.
Do I need to split the array into 3, one for each column, to do this? Or is there a formula node that lets me specify which array column/row/element to use?
08-01-2011 09:48 AM - edited 08-01-2011 09:49 AM
All you need to use is Index Array.
08-01-2011 09:54 AM
Hi
You can use Index Array to choose one element from an array, try using context help Help>Show Context Help to see how to wire the Index Array. For further help you can also use Help>Find Example where you can find usefull examples. Index Array can be also expanded. I have posted a picture of connecting the index array.
Hope it will help.
08-01-2011 10:02 AM - edited 08-01-2011 10:03 AM
By default, autoindexing FOR loops iterate over Rows, so once you have the math for one row, simply place it inside a FOR loop and iterate over all rows.
Here's an example: