From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get number of occurrence and index of multiple number in an 1D array

Solved!
Go to solution

@crossrulz

Personally, I'm thinking Variant Attributes where the attribute is an array of indexes.  Create the attribute name based on the value, Get Variant Attribute to get the current array, Build Array to add the current index, and the Set Variant Attribute to write it.  Just make sure the variant is in a shift register.  You can then get all of the attributes with a Get Variant Attribute and do whatever you have to with the final data.  Once you get the array out, it is simple enough to do an Array Size to figure out if it was duplicate and how many times it is in the array.

 

Dear Crossrulz

Your algorithms is quite advanced to me :(.

 

I have just tried to connect the input array and the found element array to a Get Variant Attribute and see the output results. The output variant give me the value corresponding to the index like:

[0] ---> 5.00

[1] ---> 3.00

[2] ---> 3.00

 

I will read more example about Variant Attributes to implement it.

 

Thank you so much!


 

0 Kudos
Message 11 of 13
(7,020 Views)
Solution
Accepted by topic author don_Micheal

wrote: Your algorithms is quite advanced to me :(.

 VI saved in 2014.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 12 of 13
(7,006 Views)

Thank you all for your help.

 

I have learnt many things from your suggestion and your VIs.

 

Micheal

0 Kudos
Message 13 of 13
(6,984 Views)