LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

character frequency plotter

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...

0 Kudos
Message 1 of 7
(3,704 Views)

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.

Message 2 of 7
(3,698 Views)

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..

0 Kudos
Message 3 of 7
(3,681 Views)

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.)

 

 

0 Kudos
Message 4 of 7
(3,675 Views)

This is how i started.

i know its very messy, but i have just started coding in LV last week only..

 

 

0 Kudos
Message 5 of 7
(3,662 Views)

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.

0 Kudos
Message 6 of 7
(3,649 Views)
Message 7 of 7
(3,643 Views)