How can I detect the third saturday of each month?

2 次查看(过去 30 天)
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!

采纳的回答

Jan
Jan 2017-2-21
编辑:Jan 2017-2-21
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by