File Exchange

image thumbnail

UIGETDATE

version 1.0 (3.42 KB) by

UIGETDATE displays a dialog box in form of a calendar.

23 Downloads

Updated

View License

UIGETDATE date selection dialog box
   T = UIGETDATE(D) displays a dialog box in form of a calendar
   
   UIGETDATE expects serial date number or standard MATLAB Date
   format (see DATESTR) as input data und returns serial date number
   for the selected date and time.

   UIGETDATE by itself uses the current date and time as input data

Example:
        t = datestr( uigetdate('16-Aug-1974 03:00') )

See also datevec, datestr, datenum

Comments and Ratings (18)

One issue that's needed to be fixed is the CLOSEREQ call.
Like Tal Shir recognized before, when UIGETDATE is called within another GUI, closing the window causes the closure of the calling GUI.
to fix that:
replace line 120: closereq
with this: delete(findobj(0,'Tag','uigetdate'))

excellent - works on OS X

Juan Vallejo

Gracias, es justo lo que buscaba

per isakson

uigetdate has served well for many years, but now the new version of datenum (R2013b?) issues an error.

Fix:

% tmp = {'Januar' 'Februar' 'March' 'April' 'May' 'Juni' 'Juli' ...
% 'August' 'September' 'October' 'November' 'December'};
   tmp = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'};

and

      out = datenum([num2str( ...
               get(findobj(gcf,'Tag','cday'),'UserData')) '-' ...
               get(findobj(gcf,'Tag','months'),'String') '-' ...
               get(findobj(gcf,'Tag','year' ),'String') ' ' ...
               get(findobj(gcf,'Tag','time' ),'String') ':00'] ...
            , 'dd-mmm-yyyy HH:MM:SS' );

I added the format specifier.

Now it seems to work again.

Yaad

Yaad (view profile)

GREAT work!

JY Su

JY Su (view profile)

Amazing !!

Liam Kelly

Great tool. However, it will not compile as a stand alone application with the MCR compiler because of the use of strings as callback functions (e.g. ...'callback','uigetdate(gcbo,''year'')')

Liam Kelly

Jan Simon

Jan Simon (view profile)

Hi Elmar! This is the the nicest and coolest GUI built by conventional MATLAB methods I've ever seen. Beside the usability, it is an excellent example for advanced programmers. Thanks!

Deshan Yang

Deshan Yang (view profile)

Fantastic. It is exactly what I need.

This is a fantastic DateGUI, as Matlab doesn't have such utilities. It can be easily integrated in any Matlab code, in which a calendar is need.

Great Job

Tal Shir

Sorry for adding the rating twice. a small point is the try catch lines. If the gui is used in a parent gui the closereq command will close the main gui in case the x button was used to close the uigetdate. a solution can be to add the following lines between catch and end:
 out = [];
      if strcmp(get(gcf,'tag'),'uigetdate') % close only if calander is not close already
        closereq
      end

Gilles Criton

I have not yet practice a full test in order to see if there are some bugs, but at first glance, this function is very impressive and useful ! Thank you very much

Blaz Daskobler

Indeed a very handy tool, thanks a lot.
But, as a previous user observed, the "closereq" command (line 120 to be precise, not 127) needs to be commented out.
You close the uigetdate figure with the "X" (or Close) anyway, and that's why that "closereq" command closes the figure calling uigetdate.

per isakson

It looks nice and works well. However, I encounter a minor issue. When I click the Close Button in the Title Bar "my" figure is closed together with the uigetdate figure. By stepping through the code with the debugger I see that <line 117 uiwait> closes the uigetdate figure and that <line 127 closereq> closes my figure. Don't ask me why (R2006b)! Commenting out <line 127> seems to solve the issue.

Malcolm Wood

This is really impressive.

Kevin Delaney

Just what I was looking for!

Andreas Geissler

Hello, the M-File works great.
No problems !

MATLAB Release
MATLAB 7.0.4 (R14SP2)
Acknowledgements

Inspired: PlotMeTheGreeks, uisetdate2(varargin)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video