From 6d4452b21b512598aeaf134baa27ba9c94ef3484 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Mon, 16 Mar 2020 14:57:46 +0100 Subject: [PATCH] use `assignin` instead of globals --- src/gui_posterior_distribution.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui_posterior_distribution.m b/src/gui_posterior_distribution.m index 1078a87..dd131d9 100644 --- a/src/gui_posterior_distribution.m +++ b/src/gui_posterior_distribution.m @@ -157,15 +157,14 @@ handles.pushbuttonSimulation = uicontrol( ... function pushbuttonPosterior_Callback(~, ~) switch handles.buttongroup.SelectedObject.String case 'IRF' - global posterior_irf if sum([handles.endoTable.Data{:,1}]) ~= 1 || sum([handles.shocksTable.Data{:,1}]) ~= 1 gui_tools.show_error('For IRF you must choose 1 endogenous and 1 exogenous variable'); end posterior_irf = get_posterior_irf( ... handles.endoTable.Data{[handles.endoTable.Data{:,1}],2}, ... handles.shocksTable.Data{[handles.shocksTable.Data{:,1}],2}); + assignin('base', 'posterior_irf', posterior_irf); case 'Covariance' - global posterior_covariance selected = handles.endoTable.Data([handles.endoTable.Data{:,1}], :); switch size(selected, 1) case 1 @@ -175,34 +174,35 @@ handles.pushbuttonSimulation = uicontrol( ... otherwise gui_tools.show_error('For Covariance you must choose 1 or 2 endogenous variables'); end + assignin('base', 'posterior_covariance', posterior_covariance); case 'Smoother' if sum([handles.endoTable.Data{:,1}]) ~= 1 gui_tools.show_error('For Smoother you must choose 1 endogenous variable'); end - global posterior_smoother posterior_smoother = get_posterior_timeseries('smoothed', ... handles.endoTable.Data{[handles.endoTable.Data{:,1}],2}); + assignin('base', 'posterior_smoother', posterior_smoother); case 'Filter' if sum([handles.endoTable.Data{:,1}]) ~= 1 gui_tools.show_error('For Filter you must choose 1 endogenous variable'); end - global posterior_filter posterior_filter = get_posterior_timeseries('filtered', ... handles.endoTable.Data{[handles.endoTable.Data{:,1}],2}); + assignin('base', 'posterior_filter', posterior_filter); case 'Update' if sum([handles.endoTable.Data{:,1}]) ~= 1 gui_tools.show_error('For Update you must choose 1 endogenous variable'); end - global posterior_update posterior_update = get_posterior_timeseries('updated', ... handles.endoTable.Data{[handles.endoTable.Data{:,1}],2}); + assignin('base', 'posterior_update', posterior_update); case 'Forecast' if sum([handles.endoTable.Data{:,1}]) ~= 1 gui_tools.show_error('For Forecast you must choose 1 endogenous variable'); end - global posterior_forecast posterior_forecast = get_posterior_timeseries('forecast', ... handles.endoTable.Data{[handles.endoTable.Data{:,1}],2}); + assignin('base', 'posterior_forecast', posterior_forecast); otherwise gui_tools.show_error('Should not arrive here'); end -- GitLab