01-29-2010 08:18 PM
I was wondering whether there was any efficient way to do that.
Let's say I have two text files that are 1d arrays:
Array1: Array2:
0 0
0 0
0 0
0 100
100 0
0 100
0 0
100 0
0 0
Basically I want something that goes through each value of array1, and if it sees a number above a certain threshold (in this case, the 100), it checks the corresponding entry n in array2, as well as n-1 and n+1. If there are numbers above a threshold in either n-1, n, or n+1, then add one to a counter variable. Otherwise do nothing.
So in my two arrays, there should be 1 count. Array1 and array2 will always have the same number of rows.
Something like this would be trivial with Java or Matlab using a for loop, but I'm not sure how to do it with LabVIEW. I can handle the if's, but I'm not sure how to represent "n-1" or "n+1".
Solved! Go to Solution.
01-29-2010 08:56 PM - edited 01-29-2010 08:56 PM
LabVIEW has for loops too.
01-29-2010 11:07 PM
And now for the requisite message:
To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.
01-30-2010 11:35 PM
01-30-2010 11:57 PM
Left to right:
Decimal String to Number
Greater Than
For Loop
Case Statement
Decrement
Index Array
Increment
Compound Arithmetic
Select
The for loop has a shift register and the data is wired straight through in the false case.
Take the tutorials mentioned above.