How can I detect the third saturday of each month?
2 views (last 30 days)
Show older comments
Hello everyone! I have the follow vector of date-number:
734321 734328 734336 734342 734349 734356 734363 734371 734377 734384 734391 734399 734405 734412 734419 734427 734433 734440 734447 734454 734462 734468 734475 734482 734490 734495 734503 734510 734517 734525 734531 734538 734545
I need to remove from the array each dates (numbers) who aren't the third saturday of the month. How can I do? Many thanks!
0 Comments
Accepted Answer
Jan
on 21 Feb 2017
Edited: Jan
on 21 Feb 2017
d = [734321 734328 734336 734342 734349 734356 734363 734371 734377 ...
734384 734391 734399 734405 734412 734419 734427 734433 734440 ...
734447 734454 734462 734468 734475 734482 734490 734495 734503 ...
734510 734517 734525 734531 734538 734545];
dSaturday = d(weekday(d) == 7); % Saturdays only
dv = datevec(dSaturday);
dThird = d(dv(:, 3) >= 15 & dv(:, 3) <= 21);
More Answers (0)
See Also
Categories
Find more on Dates and Time 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!