11-25-2020 03:08 AM
hello,guys
I met one issue that can not get newest value in 2D array and tried to find ways to solve it.
2020/11/25 9:04:49 A
2020/11/25 9:04:49 B
2020/11/25 9:06:49 A
2020/11/25 9:04:49 C
2020/11/25 9:08:49 A
2020/11/26 9:04:49 B
2020/11/26 9:04:49 A
2020/11/27 9:04:49 C
2020/11/27 9:04:49 A
I want to get newest value A,B,C .Can you share your idea?I tried to use OpenG function but failed.
Solved! Go to Solution.
11-25-2020 04:00 AM
Hi Jonathan,
suggestion:
See how far you get and attach your VI (not just an image of parts of block diagram)!
11-25-2020 10:58 AM
I assume you want the newest row for each unique item in the second column.
If you have a recent LabVIEW version, I would use a MAP.(key: string, Value: timestamp or equivalent)
Iterate over the 2D array and add new Map entries with the element from the second column as key and the time as value. Whenever the key already exists, update the value with the larger of the old or new timestamp. At the end, extract all map elements. This makes it most flexible, because you don't even need to know what the possible values of the second column are.
11-25-2020 11:27 AM
@altenbach wrote:
If you have a recent LabVIEW version, I would use a MAP.(key: string, Value: timestamp or equivalent)
Here's how that could look like:
(Note, since you seem to prefer pictures over VIs, I only show a code image ;))
11-26-2020 12:32 AM
altenbach,Thanks a mil.
it seems you used LV 2019 for this solution ,my version is LV 2018.
Is In placement element sructure used in the for loop?I never see it.
11-26-2020 12:34 AM
No, the MAP datatype is only available in LabVIEW 2019 and newer. (You could do something similar with variant attributes, but that'll be more convoluted.)
11-26-2020 02:18 AM
Really helped me a lot.Thanks.
11-26-2020 02:22 AM
I tried but it seems not I want.You can check the answer in this topic.It works.
Thanks.
11-26-2020 02:26 AM
Hi Jonathan,
@Jonathan_Rao wrote:
I tried but it seems not I want.You can check the answer in this topic.It works.
So "it works" but "it seems not want you want"?
Maybe it's time you attach your current implementation (aka your VI)!?
11-26-2020 03:20 AM
Hi,I attached VI here .Willing to get your proposal.
LV version 2020.