how find frequency of a number from an array where we can specify the length in which frequency must be checked

2 vues (au cours des 30 derniers jours)
i have array of numbers (854 numbers), so to check the frequency of numbers in the length which we specify.
  2 commentaires
Birdman
Birdman le 14 Fév 2018
You want to find index of the frequency? Share your data.
M ANBUCHELVI
M ANBUCHELVI le 1 Mar 2018
i want frequency of 1,2,3 in the given xl sheet for a given index

Connectez-vous pour commenter.

Réponse acceptée

ES
ES le 14 Fév 2018
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

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by