11-14-2012 08:53 AM
Hi All,
I have a sorted string array (see ataached) which contain strings, numeric as T1-1,T1-2.....T8-1,T8-2...T32-1.What I want to do is to be able to select the completeT8 and T9 parts and put it at the start of the array keeping remaining array sorted.Is there a way to do this. I am trying to match and replace but getting confused in its usage.
Thanks for the help.
Ankit G
Solved! Go to Solution.
11-14-2012 09:05 AM
First you need to search to find the desired range. I recommend a hidden gem in vi.lib. It can be found at LV folder\vi.lib\AdvancedString\Match 1D String Array.vi. Disclaimer: using undocumented VIs in vi.lib can be dangerous and not always carried over from LV version to LV version.
So with this guy, you can search for the beginning of your T8 range. You can do the same for the T9 and/or T10. With these indecies, you can pick out your range, delete them from the original array, and append to the front of the array.
11-14-2012 09:22 AM - edited 11-14-2012 09:23 AM
A solution below.
11-14-2012 09:40 AM
@SLee2004 wrote:
A solution below.
Hi Sum,
Thanks, but the code remove all the other strings T1,T2...T7, and it repeats the T8s and T9s.
11-14-2012 09:43 AM
AnkitG wrote:but the code remove all the other strings T1,T2...T7, and it repeats the T8s and T9s.
As I said before, you need to find the range of the T8s and T9s and delete them from the original array. With the given VI, you can use the index information to figure out this range.
11-14-2012 10:31 AM - edited 11-14-2012 10:32 AM
The "Tooth Strings (out)" contains your original sorted array "Tooth Strings (in)" with T8 and T9 at the beginning. There is no deleted elements or repeated elements. Attached is the code.
11-14-2012 11:45 AM
@crossrulz wrote:
AnkitG wrote:but the code remove all the other strings T1,T2...T7, and it repeats the T8s and T9s.
As I said before, you need to find the range of the T8s and T9s and delete them from the original array. With the given VI, you can use the index information to figure out this range.
Thanks a lot, i am able to delete the part of the array and append it to front.