06-06-2014 09:49 AM
This meetings challenge was:
Create a VI that counts the number of occurrences of each character in a block of text and displays the information on the front panel.
Ignore case and only count alphabetic characters (i.e. 'a' through 'z').
06-06-2014 09:57 AM
Here's my solution.
I used the native 'Search and Replace String' vi to count the occurence of each character. This has options to ignore case and to find all.
For the display I create a wordcloud using NI Vision vis.
Each letter size is scaled to correspond to it's frequency in the text and placed into an empty spot in the front panel image.
It tries to position each letter in the centre and spirals out until it finds a big enough space to place it.
Finally, you can make the picture prettier by changing the text to pink and adding a flowery border!
Bryan
06-06-2014 10:35 AM
I see we are uploading soutions so here is my effort.
Basic operation:
Sample some existing text so I have an excuse to have a "generate" button
Go through the text an alphabetic character at a time, determine which letter it is by the byte-code and then increment the counts in the corresponding Counts Array. This can then be sorted by the number which is occurs most or least.
Produce an image of a periodic-table-esque "tile" using a cluster and a get control image invoke node. Arrange these images into a picture control which is displayed on the front panel.
John
06-06-2014 10:50 AM
Here's my solution.
Dead simple: it converts a string to a byte value and then uses that value to increment an element in the counter array. The counted values are then displayed in an image control.