visualize the repeated data.
1 view (last 30 days)
Show older comments
Daniel Castro
on 21 Oct 2015
Commented: Daniel Castro
on 21 Oct 2015
A=["daniel", "andres", "daniel","luis","jose"] I want to be displayed A= daniel daniel
0 Comments
Accepted Answer
the cyclist
on 21 Oct 2015
Here's one way:
A = {'daniel', 'andres', 'daniel', 'luis', 'jose'};
% Use "unique" to find indices to unique elements
[~,idxFromAllToUnique,idxFromUniqueToAll] = unique(A,'stable');
% Count the number of unique elements
counts = histcounts(idxFromUniqueToAll,[unique(idxFromUniqueToAll); Inf]);
% Idenyify the indices of the non-duplicated elements
indicesToRemove = idxFromAllToUnique(counts==1);
% Remove them
A(indicesToRemove) = [];
3 Comments
the cyclist
on 21 Oct 2015
Daniel, this is a completely different question from your original one. Rather than burying it in a comment (where very few people will notice it), you should open a new question. Try to make each question specific and self-contained, so that you can get help on each part of what you are trying to do. Remember that people cannot read your mind, so tell them what they need to know to help you.
Also, if the answers from Image Analyst or me helped you solve this question, you should upvote and accept, to "reward" us and help guide others to helpful answers.
More Answers (1)
Image Analyst
on 21 Oct 2015
If you have the Statistics and Machine Learning Toolbox, you can use nominal():
A={'daniel', 'andres', 'daniel', 'luis', 'jose'}
histObject = histogram(nominal(A))
for k = 1 : length(histObject.Values)
name = histObject.Categories{k};
fprintf('%s is there %d times\n', name, histObject.Values(k));
if histObject.Values(k) >= 2
fprintf('%s %s\n', name, name);
end
end
2 Comments
Image Analyst
on 21 Oct 2015
Sorry, I don't have the database toolbox and do very little with databases or date processing. I don't even know what form your dates are being returned in.
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!