i want to know how many times a value repeated in excel

i have an excel file that has only numbers on it, and i want to know how many times a value repeated Example: 1 2 3 4 5 5 5 6
here 5 has been repeated 3 times, how can i find that by matlab?

Answers (2)

If you know which value you want to find the count of
a=[1 2 3 4 5 5 5 6]; % input values
numberofFives=sum(a==5)

7 Comments

no sir i dont know which value
then use
[count , number]=hist(a,unique(a));
[number' count']
i have a very long sheet in excel, and i want to find if there is a value that has been repeated. instead of going over it, how can matlab help on that?
then read on XLSREAD, import data into matlab and use
[count , number]=hist(a,unique(a));
morethan1=find(count>1);
[number(morethan1)' count(morethan1)']
what is (a) refer to?
sorry for bother
a=[1 2 3 4 5 5 5 6]; % a was your input series of numbers
[number(morethan1)' count(morethan1)']
there is an error massege in this line sir:
Error using horzcat CAT arguments dimensions are not consistent.
Error in LotteryFinder (line 10) [number(morethan1)' count(morethan1)']

Sign in to comment.

Read the data in using XLSREAD. Then use HISTC.

Tags

Asked:

on 6 Nov 2012

Community Treasure Hunt

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

Start Hunting!