How to isolate duplicate strings in cell array?

6 views (last 30 days)
I have a large cell array like:
words =
613×1 cell array
{'still'}
{'while'}
{'until'}
{'light'}
{'still'}
{'built'}
{'field'}
{'child'}
{'build'}
{'liked'}
{'until'}
{'plain'}
{'alike'}
{'alive'}
.
.
.
I am trying to isolate repeat words and output them in my command window
output:
'still'
'until'
How do I go about doing this? I am having issues with the unique function.
Thank you for your help!

Accepted Answer

Mathieu NOE
Mathieu NOE on 28 Mar 2022
hello
here you are :
a = [ {'still'};
{'while'};
{'until'};
{'light'};
{'still'};
{'built'};
{'field'};
{'child'};
{'build'};
{'liked'};
{'until'};
{'plain'};
{'alike'};
{'alive'}];
[C,IA,IC] = unique(a);
output = a;
output(IA) = [];

More Answers (0)

Community Treasure Hunt

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

Start Hunting!