Skip to content
Snippets Groups Projects
Verified Commit 6d4452b2 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

use `assignin` instead of globals

parent c01bcb09
Branches
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment