Info

此问题已关闭。 请重新打开它进行编辑或回答。

Can Any One Help im Matrices Comparisons in Matlab!

1 次查看(过去 30 天)
Hello How are you ?
I have a text file named as Final.txt, which consists of words in merged format. These words are from 6 txt files. I wish to compare this Final.txt with each txt file individually and check which words appears how many times.
Like suppose the word small exists in Final.txt file and file named Sports.txt exists. I have calculated words frequencies of Sports.txt individually. Now, I just want to check that how many times this word small appears in Sports.txt file and similarly in other txt files?
I can do it manually but it is taking too much time as words are in lots of ratio.
Thanks a lot
  9 个评论
Mazhar Iqbal Rana
Anyway.. My problem is still there please solve if anyone can
Jan
Jan 2014-1-6
What exactly is your problem? You describe the goal and write, that you have "made a function". But what is your question then? How can we help you?

回答(1 个)

Walter Roberson
Walter Roberson 2014-1-7
Write a routine that, given a file name, finds all the unique words in the file, and their relative frequencies, and returns both the words and their frequencies.
Write a loop over all of the file names, that runs the above routine on the file name, and stores the words and relative frequencies for each file.
Put together all of the word-lists and extract the unique words to find the list of all words used.
Now loop over each word in the list of all words used. For each one, look in each per-file word list to determine whether it existed in that file, and if it did look up the corresponding frequency. Store the counts for each of the files in a table (that is, looping over the per-file information). Continue doing this for each of the words. The end result should be a table of each word and the counts per file.
Now do whatever you are supposed to do with the counts -- printing it out as absolute counts, printing out a table of relative frequencies amongst the files, just indicating which file the word was used the most in, or whatever.

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by