06-27-2011 01:22 PM
Hello,
I am new to labview and am trying to search through a 2-D array for multiple conditions. My data is currently in excel and I have imported it into labview using "read from spreadsheet". Now I would like to search specific columns for specific data (i.e., column 2 search for EF-011, column 4 search for MT-022). Using this search I want to create certain conditions (i.e., if no EF-011 found pop-up saying NO MSL AWAY) and/or create a summary of the searched data (i.e., (6) EF-011 found). Any help is appreciated!
06-27-2011 01:27 PM
Can you attach a sample of your data for us to work with?
06-27-2011 01:48 PM
I'm sorry I won't be able to give a sample of my data due to security reasons. It's basically about 2000 rows of words or numbers with about 10 columns.
06-27-2011 01:51 PM
sorry I won't be able to give a sample of my data due to security reasons. It's basically about 2000 rows of words or numbers with about 10 columns.
06-27-2011 02:05 PM
Hello,
There are different ways to accomplish this. The way I find easiest is to use a for loop and use the indexed addressing. For a 2D array you could place a for loop inside a for loop and index the 2D array through this where the outer loop will index the rows and the inner loop will index the columns. (i.e. the first loop will pull out the first row from the 2D array, then this row is indexed into the second for loop where it pulls in each column value in that row and this process continues until the whole array has been indexed). Inside the second for loop you can use a compare function along with an input string so that you can simply type in whatever value you are looking for. You can wire the boolean value to a case structure where you can, for instance, record the index of the value of interest, or whatever else you want to do. You also mention searching just specific columns, so to do that you can use an index array function where you can wire a control that will let the user decide what column or row they want to search through and then, again, wire the resulting 1D array into a for loop as mentioned. Also, keeping track of how many of a certain value appear is easy. Simply wire to the second for loop a constant of 0 with a shift register and then place a simple increment function inside the case structure so that whenever that value is found it will increment the count and the shift register will return the value to the initial shift register after each iteration. Simply wire a indicator to the other side of the shift register out of the case structure and it will display the number of searched for values. I'd recommend reading through some tutorials on arrays, for loops, case structures, and shift registers to get a better idea. I hope this helps!!