From a given cell array of strings, extract the non-unique strings. - MATLAB Cody - MATLAB Central

Problem 2699. From a given cell array of strings, extract the non-unique strings.

Difficulty:Rate

We are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as a column vector.

For example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.

Solution Stats

34.58% Correct | 65.42% Incorrect
Last Solution submitted on Aug 07, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
14
6

Problem Recent Solvers34

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!
Go to top of page