fastmode

版本 1.0.0.0 (1.3 KB) 作者: Harold Bien
Optimized high speed version of statistical mode, i.e. element(s) occuring at greatest frequency
1.3K 次下载
更新时间 2006/4/14

无许可证

fastmode is an improvement on 'mode.m' by Michael Robbins (File ID 5266). It ignores NaN's and properly returns multiple results if more than one element occurs at equal frequency.

M-file profiler revealed extracting unique values took 50% of the time spent in the function, and since a list of unique values were not required, a work-around has been used that makes this even faster than the first submission (25 seconds to process a 100,000 element vector iterated 1,000 times, versus original 27 seconds and Robbins' hist-based version of 69 seconds).

The function is rather robust in that it can handle even single-element vectors, but it will generate an error if you attempt to call it with an empty vector. Since it's designed for speed, no error checking is performed on the input.

引用格式

Harold Bien (2024). fastmode (https://www.mathworks.com/matlabcentral/fileexchange/10745-fastmode), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R14SP2
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Direct Search 的更多信息
致谢

参考作品: mode

启发作品: mode calculator, MatEx - Matlab extremes

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0