Insert value for the last day of the year

1 次查看(过去 30 天)
Hi,
enclosed you will find a 1044x1 datetime vector (weekly data).
I would like to create a logical vector containing 1 for the last data point of each year.
Do you have any suggestions?
Thank you for your help.

采纳的回答

dpb
dpb 2020-1-27
May be a neat way with the builtin datetime lookup functions, but first thing that comes to mind is
isyrlast=false(size(dates));
isyrlast(arrayfun(@(y) find(year(dates)==y,1,'last'),unique(year(dates))))=true;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by