Tarendra- Graduate Student Wireless Networking Lab University of Texas at Arlington. |
Tarendra- Graduate Student Wireless Networking Lab University of Texas at Arlington. |
Hi, The following code was posted to Matlab Central, by Michael Robbins: (http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectIdR 66&objectType=file) function y=mode(x) % MODE finds the mode of a sample. The mode is the % observation with the greatest frequency. % % i.e. in a sample x=[0, 1, 0, 0, 0, 3, 0, 1, 3, 1, 2, 2, 0, 1] % the mode is the most frequent item, 0. % IT'S NOT FANCY BUT IT WORKS % Michael Robbins % % [b,i,j] = unique(x); [m,k]=max(hist(j,length(b))); y=b(k); Jeff -----Original Message----- From: tlakhankar [mailto:] Sent: Wednesday, July 21, 2004 10:03 PM To: Subject: [matlab] Mode in Matlab Hi, Do any body know, How to find out mode (most occuring number in array/matrix) in Matlab? Or do you have program code to find mode? Regards, Tarendra Lakhankar _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/matlab More DSP-Related Groups: http://www.dsprelated.com/groups.php3 Yahoo! Groups Links |