% FREQ file freq.m Frequencies of members of matrix % Version of 5/7/96 % Sorts the distinct members of a matrix, counts % the number of occurrences of each value, and % calculates the cumulative relative frequencies. T = input('Enter matrix to be counted '); [m,n] = size(T); [t,f] = csort(T,ones(m,n)); p = cumsum(f)/(m*n); disp(['The number of entries is ',num2str(m*n),]) disp(['The number of distinct entries is ',num2str(length(t)),] ) disp(' ') dis = [t;f;p]'; disp(' Values Count Cum Frac') disp(dis)