07-26-2021 10:51 AM
I have a 2D array (many rows, 3 columns to be more specific). Is there a way I can look through column one for one specific word, and then take all the rows that correspond with that one word from column one and place them into a different 2D array?
Example:
Trucks Ford Silver
Cars Chevy White
Cars Toyota Red
Cars Nissan Blue
Vans Toyota Purple
I want to take anything that has "Cars" in the first column, take that whole row that corresponds, and place it into its own array.
07-26-2021 11:02 AM
Hi learning,
@LearningLabVIEW wrote:
Is there a way I can look through column one for one specific word, and then take all the rows that correspond with that one word from column one and place them into a different 2D array?
Yes!
Use a for loop to autoindex the rows. Inside the loop check the first element of the row and keep all rows starting with cars. Learn about conditional output tunnels of loops...
07-26-2021 11:33 AM
How would LabVIEW know to grab the whole row?
07-26-2021 02:03 PM - edited 07-26-2021 02:10 PM
@LearningLabVIEW wrote:
How would LabVIEW know to grab the whole row?
If you use index array on a 2D array, you have several options as explained in the help.
And yes, if you autoindex on a loop boundary you reduce the number of dimension with every autoindexing tunnel.
In your case you would get one row with each iteration where you can use an index array to inspect the first element, then decide based on its value. All basic stuff. Did you do some tutorials?
07-26-2021 02:03 PM
Hi Learning,
@LearningLabVIEW wrote:
How would LabVIEW know to grab the whole row?
It "knows" by using autoindexing on a 2D array…
Loops with autoindexing tunnels are a very basic LabVIEW concept. It is explained in those "Training resources", offered at the top of the LabVIEW board!