01-11-2021 03:59 PM
@FireFist-Redhawk wrote:
OpenG's "Remove Duplicates...
Some users (such as me!) don't have any OpenG tools installed. 😄
01-12-2021 02:52 AM
cha@bellflight.com wrote:
Thanks for mentioning wiebe@CARYA's LabVIEW 2020 approach, altenbach,
I have many LabVIEW 2018 SP1 NI PXIe hardware applications. I don't think I want LabVIEW 2020 upgrade.
The maps and sets are a very, very good reason to upgrade.
But I know there can be powers to stop upgrades...
01-12-2021 02:59 AM
@altenbach wrote:
See if this can give you some ideas.
Seems to me this is the best solution. And a good one, too.
Only addition would be that you can put it in a malleable VI, so it works for any data type.
And of course the routine fails if the first element is an empty element 😋. For strings this might never happen, but for integers you'll run into this quickly. A solution that is performant isn't that easy. If you put things in the loop (like a compare), it will get slower. You'd need to make sure the shift register is initialized with something that is not the first element, or strip the first element and always add it to the result. But that needs extra care if the array is empty.
01-12-2021 10:59 AM
wiebe@CARYA wrote:
And of course the routine fails if the first element is an empty element 😋.
Yes, an important concern. I actually thought it was a feature here to drop leading empty elements. 😄
For integers, you could initialize with the "first element-1". For floating point you can initialize with NaN, but be aware that it the array has adjacent NaNs, they will not get eliminated. (A NOT-EQUAL comparison with NaN is always TRUE!), so if you also want to eliminate adjacent NaNs while keeping only one. More code is needed.
03-30-2023 03:42 PM - edited 03-30-2023 03:46 PM
I know I am going to be shot for this, but I call them like I see them. I am stunned NI didn't see the wisdom in including a string sort tool in LabVIEW's design.
In fact, I still think I am wrong about this it is such a no-brainer.
03-31-2023 03:13 AM - edited 03-31-2023 03:23 AM
@3d0g wrote:
I know I am going to be shot for this, but I call them like I see them. I am stunned NI didn't see the wisdom in including a string sort tool in LabVIEW's design.
In fact, I still think I am wrong about this it is such a no-brainer.
There are so many ways users might want to sort strings, they probably decided not to burn their hands on it. I'd probably have done the same.
The sort vim (EDIT: vi.lib\Array\Sort 1D Array.vim) allows users to define compare (equal? and greater?) (in several ways). It's a bit technical, though.