LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrangement of Array

Solved!
Go to solution

Hello All,

I have a array as shown below Array one and have to arrage as shown below array 2

 

  Array one                          Array Two

 

N1-Network-01                    N1-Network-01

N1-Network-01                    N1-Network-02

N1-Network-01                    N1-Network-03

N1-Network-01                    N2-Network-01

N1-Network-02                    N2-Network-02

N1-Network-02

N1-Network-03

N2-Network-01

N2-Network-01

N2-Network-02

Data in array one will keep on changing it wont be fixed... Sometimes N1-network-01 once will come sometimes 10 times. But in second it should come just for one. I have done bit coding which i am attaching you. 

Thanks so much..

 

 

0 Kudos
Message 1 of 9
(4,385 Views)
Use a for loop to auto index the array. Add the first value to a new array using build array and store that value in a shift register. Store the new array in a shift register too. Then on the next loop iteration compare the previous value to the current value. If they are not equal, add it to the array again using build array. Etc etc do this until the for loop completes.
0 Kudos
Message 2 of 9
(4,375 Views)
A more efficient way would be to use replace array subset instead of build array so you use the same memory buffer, assuming you don't need that original array with all the entries elsewhere. I am on my phone so ill let someone else draw up an example
Message 3 of 9
(4,370 Views)
Solution
Accepted by topic author Sim5

Try this.  There are probably more efficient ways but I will leave that exercise for you.

 

 

Message 4 of 9
(4,364 Views)

Thanks all...

I was doing just opposite of what u all told so was not getting it... Thanks so much...

0 Kudos
Message 5 of 9
(4,351 Views)

I'd like to point out that the proposed solution wont work for all cases. Add another N1-Network-01 to the end of the array. The current solution won't add it. If you will always have the N1's grouped together (such as you sort the array first) then it won't be a problem. But if you aren't sorting the array you will run into an issue.

 

See the output difference in the attached snippet

 

 

Message 6 of 9
(4,341 Views)

Hi Imstuck,

Yes u r right i have already used this type of sorting and then only i get all N1's then N2's etc and that array only i have posted. Thanks so  much so

much for prompt posts... Thanks

0 Kudos
Message 7 of 9
(4,336 Views)

Good deal, I had assumed as much. Just wanted to make sure so you didn't have any outlying points.

0 Kudos
Message 8 of 9
(4,334 Views)

Hi,

Thanks so much for the concern....

0 Kudos
Message 9 of 9
(4,328 Views)