01-20-2015 09:57 AM
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
01-20-2015 10:33 AM
you could convert the string to a byte array, sort it and then put the values into buckets, if you will.
01-20-2015 10:36 AM
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!
01-20-2015 10:44 AM
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.
01-20-2015 10:50 AM
What have you tried? Care to share some code so we can help you figure out what went wrong?
01-20-2015 11:58 AM
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
01-20-2015 12:04 PM
On the numeric pallete, there is a Add Array Elements function.
01-20-2015 12:09 PM
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
01-20-2015 12:16 PM - edited 01-20-2015 12:18 PM
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.
01-20-2015 12:38 PM
Oke thanks, now i got everyting in the different classes but how do i cast it back an select those from the right array?