File Exchange

image thumbnail


version (7.82 KB) by Gerd Rohardt
guiDatePicker replaced the activeX module mscal.ocx which didn't work with Win7(64 bit)


Updated 10 May 2011

View License

Function call:
s = guiDatePicker('1-Jan-2011');
Select a date and close the GUI. S is the "datenum" of the selected date and time.

Cite As

Gerd Rohardt (2021). DatePicker (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Sean Irons

Note this only works for when the year is between 2000 and 2020 as there is an array index lookup.
Tried to change the year = 2000:1:2020; to something wider.
However, could not see how the y = get(handles.Year,'String'); keeps using that range starting 2000.

Eduardo Martin

Great, really useful

Vargha Payandeh

Thank you Gred for this useful too.

Its really weird, however, when I click on few dates (lets say I'm not sure what day to pick) and play with the months or years drop down boxes, all of a sudden I get the following error. Any ideas as to what could be causing this?

Index exceeds matrix dimensions.
Error in guiDatePicker>Calendar_CellSelectionCallback (line 300)
handles.Day = x{1};
Error in gui_mainfcn (line 95)
Error in guiDatePicker (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in

Error using waitfor
Error while evaluating Table CellSelectionCallback

Michael Cappello

Fit my need perfectly, thanks!

I do get the following warning, though, when I call it with an input date string as you show. I changed my copy to create the variable dt in the opening function to be:

dt = datestr(now,1);

instead of

dt = varargin{1};

Great tool - and I didn't have to write it!

Warning: The input to STR2FUNC "1-Jan-2011" is not a valid function name. This will generate an error in a future release.

Michael Cappello

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!