LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort array doesn't seem to work on an array of paths when <Not A Path> is involved

Solved!
Go to solution

See the simple VI attached with default values.  I'm using 2011 sp1.  Is anyone using a later version of LV that behaves differently?  Am I missing something sensible that dictates that <Not A Path>s should be stuck in the same position in the sorted array?!  Even more strange, when I add another empty path to the end of the array, they start to sort (kind of).

 

Insight would be helpful.

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 1 of 5
(2,924 Views)
Solution
Accepted by topic author GarryG

It seems to behave correctly in LV2012.

 

empty path

C:\

asdf

some other path

<Not A Path>

<Not A Path>

Message 2 of 5
(2,916 Views)

Wow!  Awesome.  Unfortunately, we have lots and lots of LabVIEW licenses where I work, so moving forward a version happens once every few years.  One more reason to push for it to happen.  Thanks for checking this!

 

CLA, CTA
Not my tempo... AGAIN!
Message 3 of 5
(2,908 Views)

Or you can perform your own sort, where the Not A Paths are placed where you want.  Attached is an update to your VI where it will find the Not A Paths, then remove them, then sort, then add them back.

Message 4 of 5
(2,854 Views)

Thanks Hooovahh!

 

I appreciate the fixed version, and it's always interesting to see various workarounds.  The problem I'm attacking in a larger sense is finding the unique elements in an array in the most efficient manner (see other threads).  Because of this, having sort Array handle things by itself is critical to the efficiency of a specific scheme (you can use sort to eliminate a nested loop).

 

 

 

 

 

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 5 of 5
(2,847 Views)