compare groups of items regarding overlaps
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ulrike Lohner
il 23 Giu 2021
Commentato: Ulrike Lohner
il 24 Giu 2021
Short background: I have a number of texts that are being grouped regarding their value (about 5 differing values for each variable) for number of variables; meaning that each texts appears in one value group of each variable. (group A might be text1, text7, text23, text38; etc.)
Goal: I want to compare each of these primary groups regarding any overlap of their contained items using one group as a basis; i.e. I take group A and check which texts of this group also appear in any group of another variable (of course, I am not comparing groups that belong to the same variable, since there would oviously be no overlap). In the end, I'd like to say that e.g. Text 1, 7, 23 and 38 all appear in groups A, F, J, K and so forth.
That means I do not want to compare the means or any values of the data groups, but want to know which groups share which items.
Since I am not yet that experienced yet, I can't seem to find the right code to start with; any ideas about how to tackle this task?
3 Commenti
Image Analyst
il 23 Giu 2021
What do you mean by overlapping texts? What kind of data do you have? String arrays? Character arrays? Images? Tables? Cell arrays? Structure arrays? Can you attach your data (group(s)) in a .mat file with the paper clip icon.
save('answers.mat', 'group1', 'group2', 'group3');
Use your actual variable names of course.
In the meantime, see functions like setdiff(), intersect(), contains(), ismember(), strcmpi(), etc.
Risposta accettata
SALAH ALRABEEI
il 23 Giu 2021
Use
[val,ndxA,ndxB] = intersect(A,B)
It will give you the overlapping val and its index in both groups A and B
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!