Matlab comman, count distinct items in a vector
I have been looking around the matlab help and cannot find it. I want a command that counts the number of distinct entries in a vector so that I can make a histogram (using hist(Y,nbins)) that is broken into the same number of bins as there are distinct entries.
Thanks |
ah, I found it, I was just searching for the wrong keyword. The command is unique, and takes an vector or matrix as a parameter, and returns the set for that vector/matrix (removes duplicates). So then to count the number of distinct items just get the length of that vector.
|
All times are GMT -5. The time now is 10:33 AM. |