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

clean up close project function

parent 73424c9a
Branches
No related tags found
No related merge requests found
...@@ -28,13 +28,12 @@ function gui_close_project() ...@@ -28,13 +28,12 @@ function gui_close_project()
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global project_info model_settings; global project_info
global M_ options_ oo_ estim_params_ bayestopt_ dataset_ dataset_info estimation_info ys0_ ex0_;
gui_tools.project_log_entry('Project Close',sprintf('project_name=%s; project_folder=%s',project_info.project_name,project_info.project_folder)); gui_tools.project_log_entry('Project Close',sprintf('project_name=%s; project_folder=%s',project_info.project_name,project_info.project_folder));
if project_info.modified if project_info.modified
answer = questdlg(sprintf('Do you want to save changes to project %s?', project_info.project_name),'DynareGUI','Yes','No','Cancel','Yes'); answer = questdlg(['Do you want to save changes to project ' project_info.project_name '?'], 'DynareGUI', 'Yes', 'No', 'Cancel', 'Yes');
if strcmp(answer, 'Yes') if strcmp(answer, 'Yes')
gui_tools.save_project(); gui_tools.save_project();
elseif strcmp(answer, 'Cancel') elseif strcmp(answer, 'Cancel')
...@@ -45,52 +44,26 @@ end ...@@ -45,52 +44,26 @@ end
%close all opened tabs %close all opened tabs
gui_tabs.close_all(); gui_tabs.close_all();
project_info = struct(); clearvars -global
model_settings = struct(); clear_persistent_variables(fileparts(which('dynare')), false)
M_ = struct();
options_ = struct();
oo_ = struct();
if exist('estim_params_', 'var') == 1
estim_params_ = struct();
end
if exist('bayestopt_', 'var') == 1
bayestopt_ = struct();
end
if exist('dataset_', 'var') == 1
dataset_ = struct();
end
if exist('dataset_info', 'var') == 1
dataset_info = struct();
end
if exist('estimation_info', 'var') == 1
estimation_info = struct();
end
if exist('ys0_', 'var') == 1
ys0_ = struct();
end
if exist('ex0_', 'var') == 1
ex0_ = struct();
end
%disable menu options %disable menu options
gui_set_menus(false); gui_set_menus(false);
% remove appdata % remove appdata
if(~isempty(getappdata(0,'estimation'))) if ~isempty(getappdata(0,'estimation'))
rmappdata(0,'estimation'); rmappdata(0,'estimation');
end end
if(~isempty(getappdata(0,'stoch_simul'))) if ~isempty(getappdata(0,'stoch_simul'))
rmappdata(0,'stoch_simul'); rmappdata(0,'stoch_simul');
end end
if(~isempty(getappdata(0,'estim_params'))) if ~isempty(getappdata(0,'estim_params'))
rmappdata(0,'estim_params'); rmappdata(0,'estim_params');
end end
if(~isempty(getappdata(0,'varobs'))) if ~isempty(getappdata(0,'varobs'))
rmappdata(0,'varobs'); rmappdata(0,'varobs');
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment