UICalendar User Interface
Using UICalendar in Standalone Mode
You can use the UICalendar user interface in standalone mode to look up any date. To use the standalone mode:
Type the following command to open the UICalendar GUI:
uicalendar
The UICalendar interface is displayed:
Click the date and year controls to locate any date.
Using UICalendar with an Application
You can use the UICalendar user interface with an application to look up any date. To use the UICalendar graphical interface with an application, use the following command:
uicalendar('PARAM1', VALUE1, 'PARAM2', VALUE2', ...)
For more information, see uicalendar
.
Example of Using UICalendar with an Application
The UICalendar example creates a function that displays a user interface that lets you select a date from the UICalendar user interface and fill in a text field with that date.
Create a figure.
function uicalendarGUIExample f = figure('Name', 'uicalendarGUIExample');
Add a text control field.
dateTextHandle = uicontrol(f, 'Style', 'Text', ... 'String', 'Date:', ... 'Horizontalalignment', 'left', ... 'Position', [100 200 50 20]);
Add an
uicontrol
editable text field to display the selected date.dateEditBoxHandle = uicontrol(f, 'Style', 'Edit', ... 'Position', [140 200 100 20], ... 'BackgroundColor', 'w');
Create a push button that starts up the UICalendar.
calendarButtonHandle = uicontrol(f, 'Style', 'PushButton', ... 'String', 'Select a single date', ... 'Position', [275 200 200 20], ... 'callback', @pushbutton_cb);
To start up UICalendar, create a nested function (callback function) for the push button.
function pushbutton_cb(hcbo, eventStruct) % Create a UICALENDAR with the following properties: % 1) Highlight weekend dates. % 2) Only allow a single date to be selected at a time. % 3) Send the selected date to the edit box uicontrol. uicalendar('Weekend', [1 0 0 0 0 0 1], ... 'SelectionType', 1, ... 'DestinationUI', dateEditBoxHandle); end end
Run the function
uicalendarGUIExample
to display the application interface:Click Select a single date to display the UICalendar user interface:
Select a date and click OK to display the date in the text field:
See Also
createholidays
| holidays
| nyseclosures