05-09-2016 10:27 PM
I am trying to make a text based ASCII character frequency counter/plotter, which takes a ascii text file and plots a kind of character frequency based on its occurence in the input text file.
I feel case structure based approach will be too time cosuming and very simple to implement, looking for a more modular approach, which dynamically creates a variable to store the count value whenever a new character found in the text file. for instance if i input below text lines
****************************************
alkjfglsherjhdcabr3p94053oifnhieufaliudbbdaposduhfpufapsdoifw34t5i3whofuhasdjfhalkjsdfbalsdfarhoaiuerfwiuard
aouwet;aowhta;ljfvnW(#%TCJWG(WN%$RCGW($HGNGa;rspaojfpaj0p9345u23oi4hr098fewfpdsfnupaisjfngoiarufnqfqprufa;ofunareougf;esraoufh
lkjsrhfluerfha;oeurh3[40953woirfhnlfuserfbgsiuergfbselriufbosiufboaisufbaoiufbaiouefbalkejrfbeskrjgfsi
aweurhwo3w[49uthcowthlkwjabfa[3409rhowrefbspdjbvapiu3w[409ojsrgnsjegtfnwivesbgfa;oreighpqfbupoo3w4ho34y50982e;oritgwejrkf
352345iruoefh#@$%OT#MQTGC($%Y(#$TQ(WERFQCWREG;owetnwctu nwrougnwreougtwcerougtwce;rowe
****************************************
Chart output should be
a- number of a's in above string
b- number of b's in above string
#- number of special character
A-number of capital A
B-number of Capital B
1- number of 1's
2-number of 2's
so on..
so on...
05-09-2016 10:37 PM
Is this homework?
I would convert the string to a byte array and create a histogram (autoindexing on a FOR loop and incremeting a 256 size I32 array contained in an initialized shift register at the character location.) Then just look at the bin count for each character.
05-09-2016 11:07 PM
Thanks alten,
Yeah this is for my home assignment 🙂
and i have recently started coding in labview environment, and i was trying so hard to implement this program, but couldnt proceed,
Can you please give me a little more hint on "bin count" side by side i am looking on internet as well.
Thanks a lot Sir..
05-09-2016 11:17 PM
Why don't you show us what you tried and where you got stuck?
Here is one starting point that could point you in the right direction (modify accroding to my suggestions above, of course!).
(A fancier way would use variant attributes, byt that would be more useful to e.g. count the frequency of entire words.)
05-09-2016 11:53 PM
This is how i started.
i know its very messy, but i have just started coding in LV last week only..
05-10-2016 12:44 AM
The problem has nothing to do with lines, so why are you reading lines? Just read all characters of the file into one string, then analyze it.
05-10-2016 12:50 AM