How does the command unique work?
Show older comments
Hello,
Someone at my work told me to use unique to get some values out of the array. The array is stored with values [2 3 10 11 12 13 15 17....990]. someone values between 2:990 are missing. No value is repeated, but the unique(array) produces the result [ 2 3 4 5 6 7 8 9 10] which is what I want. Can someone explain me why? I thought that unique outputted sorted unique values of that array.
1 Comment
@ubaid haroon: can you please show us the exact input values that you use, and how you call this function. unique works as expected for me, using the sample values that you gave:
>> unique([2,3,10,11,12,13,15,17,990])
ans =
2 3 10 11 12 13 15 17 990
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!