03-08-2019 03:03 PM
Hi all,
I'm using LabVIEW 2016. I have a TDMS file to which I'm recording data almost in a database-table style, in the sense that I have an index column that I want to use to pull out rows that have a matching value of the index column.
Now I can get the 2D array using TDMS Read. But then to pull out the rows that have a requested index column value, I have to go through multiple hoops of getting the value, then looping through each row and collecting the rows with matching index column values.
With SQL, I can accomplish this with a very simple query:
select * from [2D array]
where [Index Column]=1
Except, instead of a formal database table, I have a 2D array (essentially a table).
Is there such a "pseudo SQL" way to do this in LabVIEW?
Thanks!
03-08-2019 03:34 PM
Multiple hoops? Is there something wrong with doing it like this?
03-08-2019 04:00 PM
I did that exact for loop first. But it's not very convenient or scalable. If I want to do a more complex data extract, I'd have to do more of these clumsy operations. At least if there was a "Search 1D Array" that would find all instances of a value, it would make the code a bit more compact.
03-08-2019 04:12 PM
OpenG toolkit has one such function that returns the indices of the array that match your value. You can install it from VIPM.
03-08-2019 05:47 PM
@abvenk wrote:
... I'd have to do more of these clumsy operations. At least if there was a "Search 1D Array" that would find all instances of a value, it would make the code a bit more compact.
There is nothing clumsy about this code, it is quite elegant. To make the code more compact, turn it into a subVI. 🙂
What "more complex" searches do you need to do?
03-09-2019
04:35 AM
- last edited on
04-14-2025
01:48 PM
by
Content Cleaner
In case the OP was unaware, one can use SQLite (full SQL database-in-a-file) in LabVIEW.