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!