how find frequency of a number from an array where we can specify the length in which frequency must be checked
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
M ANBUCHELVI
el 14 de Feb. de 2018
Comentada: M ANBUCHELVI
el 1 de Mzo. de 2018
i have array of numbers (854 numbers), so to check the frequency of numbers in the length which we specify.
2 comentarios
Respuesta aceptada
ES
el 14 de Feb. de 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
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Operators and Elementary Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!