diff --git a/src/gui_plot_shock_decomposition.m b/src/gui_plot_shock_decomposition.m index d52ffcb544a1ebcc3f8c6af5b1de584aa395c7bb..1a51d2dc7a5748600fd414841aa427e223281f93 100644 --- a/src/gui_plot_shock_decomposition.m +++ b/src/gui_plot_shock_decomposition.m @@ -104,6 +104,8 @@ handles.pushbuttonReset = uicontrol( ... handles.use_shock_groups.Value = 0; handles.fig_name.String = ''; handles.vintage.String = ''; + handles.plot_init_date.String = ''; + handles.plot_end_date.String = ''; end handles.pushbuttonCloseAll = uicontrol( ... @@ -364,6 +366,44 @@ handles.pushbuttonClose = uicontrol( ... 'Position', [spc*3+dwidth*1.5 top-num*dheight dwidth*2 dheight/2], ... 'Value', 0); + num = num + 1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'plot_init_date', ... + 'Style', 'text', ... + 'Units', 'normalized', ... + 'Position', [spc*3 top-num*dheight dwidth*1.5 dheight/2], ... + 'String', 'plot_init_date:', ... + 'HorizontalAlignment', 'left'); + + handles.plot_init_date = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'plot_init_date', ... + 'String', '', ... + 'Style', 'edit', ... + 'Units', 'normalized', ... + 'Position', [spc*3+dwidth*1.5 top-num*dheight dwidth*2 dheight/2], ... + 'Value', 0); + + num = num + 1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'plot_end_date', ... + 'Style', 'text', ... + 'Units', 'normalized', ... + 'Position', [spc*3 top-num*dheight dwidth*1.5 dheight/2], ... + 'String', 'plot_end_date:', ... + 'HorizontalAlignment', 'left'); + + handles.plot_end_date = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'plot_end_date', ... + 'String', '', ... + 'Style', 'edit', ... + 'Units', 'normalized', ... + 'Position', [spc*3+dwidth*1.5 top-num*dheight dwidth*2 dheight/2], ... + 'Value', 0); + num = num + 1; handles.use_shock_groups = uicontrol(... 'Parent', handles.uipanelResults, ... @@ -384,6 +424,34 @@ handles.pushbuttonClose = uicontrol( ... return end options_.plot_shock_decomp.vintage = str2double(handles.vintage.String); + + if ~isempty(handles.plot_init_date.String) + if isint(str2double(handles.plot_init_date.String)) + options_.plot_shock_decomp.plot_init_date = str2double(handles.plot_init_date.String); + elseif isdate(handles.plot_init_date.String) + options_.plot_shock_decomp.plot_init_date = dates(handles.plot_init_date.String); + else + gui_tools.show_warning('Initial date must be an integer or a date'); + uicontrol(hObject); + return + end + else + options_.plot_shock_decomp.plot_init_date = ''; + end + + if ~isempty(handles.plot_end_date.String) + if isint(str2double(handles.plot_end_date.String)) + options_.plot_shock_decomp.plot_end_date = str2double(handles.plot_end_date.String); + elseif isdate(handles.plot_end_date.String) + options_.plot_shock_decomp.plot_end_date = dates(handles.plot_end_date.String); + else + gui_tools.show_warning('End date must be an integer or a date'); + uicontrol(hObject); + return + end + else + options_.plot_shock_decomp.plot_end_date = ''; + end if handles.colormap.Value ~= 1 options_.plot_shock_decomp.colormap = handles.colormap.String{handles.colormap.Value};