Effacer les filtres
Effacer les filtres

Insert value for the last day of the year

2 vues (au cours des 30 derniers jours)
BdS
BdS le 27 Jan 2020
Réponse apportée : dpb le 27 Jan 2020
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.

Réponse acceptée

dpb
dpb le 27 Jan 2020
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;

Plus de réponses (0)

Catégories

En savoir plus sur Historical Contests dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by