How to find same values in table and show them in a new table?

5 vues (au cours des 30 derniers jours)
Ergün AKGÜN
Ergün AKGÜN le 11 Mai 2019
Hi all
I have 50x30 Table name 'TToplam', 1st column contain word (Word2004), 2nd count of the word (Count2004) and this two columns represent a year. There are total 15 years data.
I want to show similarities and diversities of words.
Problem 1: How can i find similar (exactly word have to be all years) words from 1st,3rd,5th....15th column and match them with their counts in a new Table?
Example
Problem 2: How can i find diversities (Unique ones) of words in a new Table?
  4 commentaires
Image Analyst
Image Analyst le 12 Mai 2019
Can you attach the table in a .mat file witht he paper clip icon? This will make it easier for us to try code with it.
Ergün AKGÜN
Ergün AKGÜN le 13 Mai 2019
Hi Image Analyst
I attached the .mat file

Connectez-vous pour commenter.

Réponses (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 11 Mai 2019
One of the possible ways is to write a small function file with fgetl(), ischar(), strfind(), etc., like this one. This can search for specific words in your data file, e.g. MY_table.csv
function W=wordsearch_ALL(myfilename, WordSpell)
% The script reads and searches for keywords.
% e.g.: >> W = wordsearch_ALL('MY_table.csv', 'student')
fid=fopen(myfilename);
w=0;
wholeline=fgetl(fid);
while ischar(wholeline)
match_found=strfind(wholeline, WordSpell);
num=max(size(match_found));
if num>0
w=w+num;
fprintf(1, '%d:%s\n', num, wholeline);
end
wholeline=fgetl(fid);
end
fclose(fid);
Good luck

Peter Perkins
Peter Perkins le 14 Mai 2019
Your first question is just an inner join, I think. Perhaps an outer join, you have not explained sufficiently. You'll have to split the one table into 15 tables though.
Not sure I understand what the second question means. Maybe you want to vertically concatenate those 15 tables and cal unique on the (one) Word variable? You'll need to make the (two) variable names match in all 15 to vertcat them.

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by