visualize the repeated data.

1 view (last 30 days)
Daniel Castro
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

Accepted Answer

the cyclist
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
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.
Daniel Castro
Daniel Castro on 21 Oct 2015
Thank you for the advice

Sign in to comment.

More Answers (1)

Image Analyst
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
Daniel Castro
Daniel Castro on 21 Oct 2015
One wonders if would be so kind There is the possibility of Matlab data extraction from specifically mysql, I have a database check and departure dates and hours ..etc I make a report with dates ... Example from (15 Oct 2015) to (19-Oct-2015) and visualize me all users who have entered in that range of dates either (uitable, excel, txt, etc) ..
Any information would help me beforehand many thanks
Image Analyst
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!