LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate an Array from existing one

Hello
 
I'm trying to generate a 1D array from and existing 1D array, where the new array only contains data that is different
 
i.e data for input array = 12,12,13,28,28,28,39,39
 
data in new array = 12,13,28,39
 
I've had a go at something, but I can't find a VI that simply lets me buld a new array using data values and indexes, see below:-
 
 
Any elegant solutions to this?
 
Cheers
Ieon
 
 
0 Kudos
Message 1 of 8
(3,597 Views)

Download  the solution to your problem (Remove Duplicate.vi) from http://www.openg.org where you will find a lot of other valuable tools. And it's free (as the help here...) !

 

 

Chilly Charly    (aka CC)
Message 2 of 8
(3,570 Views)
Use Remove Duplicates from 1D Array from OpenG.
Message 3 of 8
(3,569 Views)
Hello Electrode,
you could use a vi from OpenG like you've been said, but also, if you want to do some practice, you can modify a little your example doing the following:

1.Your input array has N elements; initialize a For cycle as it executes N-1 times
2. Wire the input array to a Shift Register (in)
3. Scan the input array in reverse (starting from the last); check equality between adiacent elements
4. If TRUE delete the element with higher index (use  Delete from Array). If FALSE do nothing
5. Wire the result to the Shift Register (out) and it's all....

bye,
manga




0 Kudos
Message 4 of 8
(3,547 Views)
OpenG would be one possible solution.  If your looking for the most elegant (or easiest) is of course to use the functionality already built into LabVIEW.  Reuse is a good thing.  I believe this VI is part of the advanced analysis libraries (LabVIEW Full or higher).  You can check if you have it by bringing up the functions palette and hitting the search button and looking for "Unique Numbers and Multiplicity".
 
 
0 Kudos
Message 5 of 8
(3,531 Views)
It's not in mine. What other toolkits do have?
0 Kudos
Message 6 of 8
(3,520 Views)
Hey Dennis, actually I dont have anything out of the ordinary... I have LabVIEW Pro and DAQmx installed and thats about it.  Its under Mathematics>>Polynomals.
Message 7 of 8
(3,500 Views)

Hello and thanks to all those that have helped with this.

 

Unfortunatley I work on a works PC and cannot add items like OpenG.

But I mananged to find the Unique numbers VI suggested by Chaos (thanks) Smiley Happy and it worked!, didn't even know that VI was in Labveiw.

My array had reals, so I simply divided, rounded before the VI and multipled back after it, worked great.

 

Thanks again

Electrode (Ieon)

0 Kudos
Message 8 of 8
(3,471 Views)