How to get a UI to capture start and end date from user.

Hi! I am using questdlg to ask user if he wants to use default date range or a custom date range. If the user selects Custom date range. I want to pop up a UI that can in the same window have two calendars to capture start and end date. Also, i want the figure to have a editable box where if the user wants he can manually enter the date or else click on calendar. and if the user by accident clicks close it takes the default date range option from the questdlq case.
Please, let me know if my question is not very clear.
I am using MATLAB 2017(a)
Thanks

5 Comments

Your question is clear. What have you tried so far? There are quite a few steps needed to put together this GUI and I doubt someone will do it all for you. With some ' googling ' and searching in these forums, I bet you could do much of this yourself. Learning how to make GUIs is rewarding.
Are you using GUIDE or are you developing the GUI using uicontrol()?
See how far you can get and if you stumble upon something more specific, come back to the forums.
Actually initially i was trying to use uicontrol but now i am trying to use GUIDE to get the UI that i want. Your are absolutely rite Learning UI is actually rewarding. I have been able to get 30% of the design so far. I am googling where ever i am getting stuck. Hope i will be able to pull it off. The reason i posted the question was because initially i was using UI control and I was having hard time doing it. But with Guide its not that complicated. I will share my result once i have it all together.
I used GUIDE when I started learning and that was really helpful. Keep doing that. Smaller GUIs are easier to make with uicontrol(). Good luck.
Ok I got most of My GUI I just need help with one more thing to complete the GUI. So I am using GUIDE, and i want it to give output which i am able to get from the OutputFcn callback but i also have a OK button in my GUI and that OK button is supposed to close the GUI for which I am using delete(handles.figure1). Now it does close the figure for me but as its deleting the figure it will even remove varargout output from my outputFcn. can any one help me how can i combat this.
This is my code for getting output and the OK button
function varargout = DateSelectorGUI_SPC_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = get(handles.edit1,'String');
varargout{2} = get(handles.edit2,'String');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
delete(handles.figure1)
All functions stored in your GUI script created by GUIDE will be deleted along with your GUI when you close the GUI. If your goal is to make the GUI disappear but keep the functions and variables, maybe you could toggle the GUI's visibility instead of closing it.

Sign in to comment.

Answers (1)

Try this.. https://undocumentedmatlab.com/blog/date-selection-components

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 24 Jul 2018

Commented:

on 27 Jul 2018

Community Treasure Hunt

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

Start Hunting!