Hi Ayyaz,
If X is the array of elements, do:
Y = sort(X);
N = histc(X,Y);
Y(N==0) = [];
N(N==0) = [];
Then, N(i) is the number of occurences of element
Y(i). At this stage, Y is the sorted version of unique
elements in X.
For plotting use, hist(X,Y).
Amit
--- ayyaz mahmood wrote:
> Hello All
>
> I have an array of 20,000 different numbers. I do
> not know which numbers are in this array and how
> many times they are present. I want to know how many
> times each number is present in this array. So i
> want the result in a form like this (this is an
> example). I know the i can use find function to
> access the index of each element and then length
> function to count how many times one number is
> present. But the problem is i have 20,000 values and
> it is very difficult and lenghty to use find and
> length function for each value.
>
> Is there any matlab function for counting each
> element in the array of 20000 numbers
>
> Number No of times each number is present
> in the array
>
> 1.3
>
>
> Also which function i can use for plotting
>
> Thanks in advance
>
>