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?
답변 (2개)
Thomas
2012년 11월 6일
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
Mohammed
2012년 11월 6일
Thomas
2012년 11월 6일
then use
[count , number]=hist(a,unique(a));
[number' count']
Mohammed
2012년 11월 6일
Thomas
2012년 11월 6일
then read on XLSREAD, import data into matlab and use
[count , number]=hist(a,unique(a));
morethan1=find(count>1);
[number(morethan1)' count(morethan1)']
Mohammed
2012년 11월 6일
Thomas
2012년 11월 6일
a=[1 2 3 4 5 5 5 6]; % a was your input series of numbers
Mohammed
2012년 11월 8일
Matt J
2012년 11월 6일
0 개 추천
Read the data in using XLSREAD. Then use HISTC.
카테고리
도움말 센터 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!