MATLAB: I have a vector Y=[1, 1, 1, 2, 2, 2,2,2, 3, 3, 3,4]. How to make matlab tell that the total number of values that are different from each other in the vector is 4? thank you very much

how to extract particular values from a vector

I have a vector Y=[1, 1, 1, 2, 2, 2,2,2, 3, 3, 3,4]. How can I make matlab tell that the total number of values that are different from each other in the vector is 4? thank you very much

Best Answer

doc unique
doc length
and you'll find a simple solution using both functions