Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1039. Get an array of month-ends in a date range

Created by T.D.

Create a function that would return a list of month-ends falling in a given date range. If a start date or end date falls on a month-end, that date should be included in the output (close ended range)

For example:

date_start = datenum('10 Nov 2010');
date_end   = datenum('10 Feb 2011');
dates_me   = month_ends(date_start, date_end); 
datestr(dates_me)
ans =
30-Nov-2010
31-Dec-2010
31-Jan-2011

Tags

Problem Group

Solution Statistics

34 correct solutions 36 incorrect solutions
Last solution submitted on Jul 09, 2014

Solution Comments