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 ...
Is this thread worth a thumbs up?
|
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 |
|
|
|
Hi, The following code was posted to Matlab Central, by Michael Robbins: (http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=52 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 _____________________________________ /groups.php3 Yahoo! Groups Links |
|
Tarendra- Graduate Student Wireless Networking Lab University of Texas at Arlington. |