Why does the unique() function give an unexpected extra output here?
Show older comments
I'm trying to find the unique elements inside a string array (attached, "datestrings_of_problem_times.mat").
When I run this (after loading "datestrings_of_problem_times.mat") ;
[datestrings_of_interest, indices, b] = unique(datestrings_of_problem_times);
The output "datestrings_of_interest" (attached, "datestrings_of_interest.mat") has an empty string ( [""] ) as its first element, but there are no empty strings inside my initial string array.
And, the output "indices" (attached, "indices") has 50877 as its first element. But, my string array has 50876 elements in the first place. So, the unique function somehow checked whether the 50877th element of a 50876x10 string array was unique or not. What am I missing / how could I fix this?

Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings 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!