LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i count different characters from a text.

Hello,

 

I'm a dutch student and I have a problem which i can't solve myself.

My English is not that good but I will try to be clear.

 

For a project we have to make a VI which can count how many a's, b's, c's ..... z's  there are in different kind of text. If we know the amount of a's , b's .... we have to put this in a graph.

 

My question is, how can we count different characters in a text? I have been working on it for a long time now and still can't find the solution.

 

Is there somebody who can help me? I have put a picture in this message which shows how it has to look. It shows the numbers 1 to 26, a = 1 b = 2 c= 3 .... z=26. And on the y-axis is the amount.

 

Kind Regards,

 

Jens

0 Kudos
Message 1 of 30
(4,067 Views)

you could convert the string to a byte array, sort it and then put the values into buckets, if you will.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 30
(4,040 Views)

I have read about that, and i think it is the most simple solution. But i'm a real rooky and it doesn't seem to work... Think i'm doing something wrong!

0 Kudos
Message 3 of 30
(4,033 Views)

Show us what you have tried so far.  Look up the terms shift register, feedback node, and conditional tunnel.  The rest is just comparisons and increments. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 4 of 30
(4,028 Views)

What have you tried?  Care to share some code so we can help you figure out what went wrong?


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
0 Kudos
Message 5 of 30
(4,025 Views)

Thanks guys, I tried a litte bit and i have found the solution! It's actually quite simple.

 

The next question is, how do i count the total of the letters? In the picture which i uploaded in this post you can see the values 97 t/m 122 these are the letters. In the array next to it, is the total of  each letter. 

 

I need something which wil look where 97 t/m 122 is in the left array an then count those positions in de right array.

 

Is this possible?

 

Kind regards, Jens

 

You have been helping me big time! Thanks

0 Kudos
Message 6 of 30
(3,989 Views)

On the numeric pallete, there is a Add Array Elements function.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 30
(3,977 Views)

Okey, but there are also characters like . , : - I don't want those characters in my count. So in the left array i need to know on which 'level' the 97 to 122 are an then count those levels on the right array. 

 

I hope I'm clear enough for you Smiley Frustrated

0 Kudos
Message 8 of 30
(3,970 Views)

You can use "lexical class" and skip everything that is not a letter (i.e. class 4 or 5).

 

For all valid numbers, simply cast the index number back to a string to get the character.

0 Kudos
Message 9 of 30
(3,963 Views)

Oke thanks, now i got everyting in the different classes but how do i cast it back an select those from the right array?

 

 

0 Kudos
Message 10 of 30
(3,948 Views)