Finding unique dates in vector
Show older comments
Hi all.
I have a vector of dates where each date is repeated many times. How would i create a vector with every date but no repetitions efficiently?
Thx.
1 Comment
Jan
on 25 May 2011
What exactly means "vector of dates"? Please post the type of the input exactly. I assume that UNIQUE will help you directly.
Accepted Answer
More Answers (1)
Daniel Svedbrand
on 12 Mar 2025
Edited: Daniel Svedbrand
on 12 Mar 2025
0 votes
unique_dates = unique(dateshift(Date,'start','day'));
if Date are datetimes, otherwise
unique_dates = unique(dateshift(datetime(Date),'start','day'));
Categories
Find more on Time Series Objects 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!