how find frequency of a number from an array where we can specify the length in which frequency must be checked
조회 수: 4 (최근 30일)
이전 댓글 표시
i have array of numbers (854 numbers), so to check the frequency of numbers in the length which we specify.
댓글 수: 2
채택된 답변
ES
2018년 2월 14일
function freqCnt = findFrequencyofNumber(arrayInput, startidx, endidx, number2bechecked)
tempArray = arrayInput(startidx:endidx);
freqCnt = sum(tempArray == number2bechecked);
end
To call,
>> freqCnt = findFrequencyofNumber([1,2,3,[1:10]], 1, 7, 3)
freqCnt =
2
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!