From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

count and filter number of occurrences of string in an array

Solved!
Go to solution

Hi.... I need filter and count display for number of strings occur in a single column of string array...I can't explain....below I just represented what is my need.  Column A is Input string array...Column B and C are the output arrays.... 

 

 

Column A          Column B            Column C

Apple                  Apple                         3

Banana              Mango                        2

Mango                Banana                      1

Apple

Apple

Mango

 

Can anyone help me...?

0 Kudos
Message 1 of 11
(5,702 Views)

If you cant explain then how can you expect answer....

 

Here I attached sample vi which will help you to some extent. Let me know if  you need any help

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 11
(5,693 Views)
I would use variant attributes. The key will be the name and the data will be your count, with a default value of zero. Do "get variant attribute, increase the count, then set variant attribute
0 Kudos
Message 3 of 11
(5,684 Views)
Solution
Accepted by topic author azadplc007

Here, I drew up a quick example of what I mentioned above.

Message 4 of 11
(5,672 Views)

ya its working... but,I need output data are sorted manner.... from max to min......

0 Kudos
Message 5 of 11
(5,638 Views)

Use sort 1D array.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 6 of 11
(5,630 Views)

Use index and bundle cluster array. Then sort. Then reverse the output array.

 

When you sort an array of clusters, it sorts by the first element. That is why you can do this because the numbers get sorted, and the name comes along for the ride. But this will sort least to greatest, so the reverse of the array makes it greatest to least.

 

0 Kudos
Message 7 of 11
(5,615 Views)

@Ranjeet_Singh wrote:

If you cant explain then how can you expect answer....

 

Here I attached sample vi which will help you to some extent. Let me know if  you need any help


Actually, Ranjeet, there is value to asking an unformed question.  People can then ask more questions to help the user define their problem.  In fact, that's the way it happens in I'd say a majority of posts here.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 11
(5,606 Views)

 


@billko wrote:
Actually, Ranjeet, there is value to asking an unformed question.  People can then ask more questions to help the user define their problem.  In fact, that's the way it happens in I'd say a majority of posts here.

 

In fact, I think the example given did a fine job of explaining, even though the words may not have. Sometimes I wish more people would post inputs and desired output, so I don't have to try and interpret what they are saying in the first place. Often times the more words there are just increase the chances of saying something contradictory when trying to explain the problem which leaves us at square one.

Message 9 of 11
(5,598 Views)

Ranjith...

I wanna say onething.....each and every people are not well qualified in all fields.... If you know one thing, I might don’t know about that....If I know something, you may not know about that... helping is always good habit.... anyway Thanks for your replying....

0 Kudos
Message 10 of 11
(5,573 Views)