allow to export expand groups to excel (instead than plotting them)

time-shift
Marco Ratto 2020-10-29 18:27:24 +01:00
parent f8b8ec6c18
commit c8cd0a06ce
3 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
function expand_group(use_shock_groups,var_list_, ic)
function expand_group(use_shock_groups,var_list_, ic, no_graph)
% function expand_group(use_shock_groups,var_list_, ic)
% Expands shocks contributions out of a group of shocks
%
@ -27,6 +27,9 @@ function expand_group(use_shock_groups,var_list_, ic)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin<4
no_graph=0;
end
filename = get(gcf,'filename');
[filepath, name, ext]=fileparts(filename);
M = evalin('base','M_');
@ -56,7 +59,12 @@ M.exo_names = mydata.exo_names;
options.plot_shock_decomp.interactive=0;
options.plot_shock_decomp.expand=1;
options.plot_shock_decomp.nodisplay=0;
options.plot_shock_decomp.write_xls=0;
if no_graph
options.no_graph.plot_shock_decomposition=1;
options.plot_shock_decomp.write_xls=1;
else
options.plot_shock_decomp.write_xls=0;
end
%% set optimal colormap
func = @(x) colorspace('RGB->Lab',x);
MAP = distinguishable_colors(length(shocks)+1,'w',func);

View File

@ -237,6 +237,8 @@ for j=1:nvar
browse_menu = uimenu(c,'Label','Browse group');
expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.plot_shock_decomp.use_shock_groups ''',''' mydata.plot_shock_decomp.orig_varlist{j} ''',' int2str(i) ')']);
set(expand_menu,'UserData',mydata,'Tag',['group' int2str(i)]);
save_expand2xls_menu = uimenu(c,'Label','Export group to xls','Callback',['expand_group(''' mydata.plot_shock_decomp.use_shock_groups ''',''' deblank(mydata.plot_shock_decomp.orig_varlist(j,:)) ''',' int2str(i) ', 1)']);
set(save_expand2xls_menu,'Tag',['xls_group' int2str(i)]);
for jmember = mydata.shock_group.shocks
uimenu('parent',browse_menu,'Label',char(jmember))
end

View File

@ -243,6 +243,8 @@ for j=1:nvar
browse_menu = uimenu(c,'Label','Browse group');
expand_menu = uimenu(c,'Label','Expand group','Callback',['expand_group(''' mydata.plot_shock_decomp.use_shock_groups ''',''' mydata.plot_shock_decomp.orig_varlist{j} ''',' int2str(ic) ')']);
set(expand_menu,'UserData',mydata,'Tag',['group' int2str(ic)]);
save_expand2xls_menu = uimenu(c,'Label','Export group to xls','Callback',['expand_group(''' mydata.plot_shock_decomp.use_shock_groups ''',''' deblank(mydata.plot_shock_decomp.orig_varlist(j,:)) ''',' int2str(ic) ', 1)']);
set(save_expand2xls_menu,'Tag',['xls_group' int2str(ic)]);
for jmember = mydata.shock_group.shocks
uimenu('parent',browse_menu,'Label',char(jmember))
end