I tried the suggestion in this thread but seems to work only for double
Table Find Duplicate Rows (double, char, datetime)
107 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, in table A with 100,000 rows and 40 columns, is there a way to find duplicate rows?
The elements are of the type: double, char, datetime
Thanks
Réponses (2)
the cyclist
le 25 Oct 2021
You might need to share some more details about your table, but you should be able to use the unique function.
% Make some pretend data, which is 8 rows with 4 unique ones
tbl = array2table([magic(4); magic(4)]);
% Find the unique rows, along with indices for identifying the duplicates
[uniqueTableRows,indexToUniqueRows,indexBackFromUnique] = unique(tbl);
See the documentation for details on the indices that are reported.
2 commentaires
the cyclist
le 26 Oct 2021
Modifié(e) : the cyclist
le 26 Oct 2021
Different data types should not be a problem with this method:
% Make some pretend data of different types
n = [1; 2; 1; 1; 2; 1];
c = {'a';'b';'a';'b';'a';'b'};
t = datetime({'2014-05-26';'2014-08-03';'2014-05-26';'2014-08-03';'2014-05-26';'2014-08-03'},'InputFormat','yyyy-MM-dd');
% Put them in a table
tbl = table(n,c,t)
% Find the unique rows, along with indices for identifying the duplicates
[uniqueTableRows,indexToUniqueRows,indexBackFromUnique] = unique(tbl)
Abdul Rehan Khan
le 12 Fév 2025 à 20:47
Apart from the indices, how can store the duplicate data in a seperate table?
0 commentaires
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!