Problem 53. Duplicates
Write a function that accepts a cell array of strings and returns another cell array of strings with only the duplicates retained.
Examples:
Input strs = {'a','b','a'} Output dups is 'a'
Input strs = {'a','b','c'} Output dups is Empty cell array: 0-by-1
Solution Stats
Problem Comments
-
4 Comments
Why not just an isequal(correct,result) in the tests?
Consequently, a lot of solutions leave duplicates in the result.
How should higher multiplets be treated?
güzell
%%
Useful function => unique, countcats, categorical
Solution:
https://github.com/AhmedNazir/MatlabCody/blob/master/duplicates.m
Solution Comments
Show commentsProblem Recent Solvers2256
Suggested Problems
-
3199 Solvers
-
Project Euler: Problem 10, Sum of Primes
1645 Solvers
-
Back to basics 22 - Rotate a matrix
887 Solvers
-
Create matrix of replicated elements
373 Solvers
-
String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
1354 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!