2010-01-26 14:18:15 +01:00
|
|
|
function storeGlobalVars(fname,append)
|
2010-10-22 11:27:26 +02:00
|
|
|
% PARALLEL CONTEXT
|
2017-05-16 15:10:20 +02:00
|
|
|
% In a parallel context, this function stores all global vars in structure
|
2010-10-22 11:27:26 +02:00
|
|
|
% fGlobalVar and saves it in the file fname.mat
|
2010-01-26 14:18:15 +01:00
|
|
|
%
|
|
|
|
% INPUTS
|
2010-12-17 09:14:35 +01:00
|
|
|
% fname [str] name of the file
|
|
|
|
%
|
2011-02-04 17:17:48 +01:00
|
|
|
% append [] flag to append globals to the storage file
|
2010-10-22 11:27:26 +02:00
|
|
|
%
|
|
|
|
% OUTPUTS
|
|
|
|
% None
|
|
|
|
%
|
|
|
|
%
|
2022-04-13 13:15:19 +02:00
|
|
|
% Copyright © 2009-2017 Dynare Team
|
2010-01-26 14:18:15 +01:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare is free software: you can redistribute it and/or modify
|
|
|
|
% it under the terms of the GNU General Public License as published by
|
|
|
|
% the Free Software Foundation, either version 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare is distributed in the hope that it will be useful,
|
|
|
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
% GNU General Public License for more details.
|
|
|
|
%
|
|
|
|
% You should have received a copy of the GNU General Public License
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2010-01-26 14:18:15 +01:00
|
|
|
|
2010-10-22 11:27:26 +02:00
|
|
|
|
2010-01-26 14:18:15 +01:00
|
|
|
GlobalNames = who('global');
|
2010-10-22 11:27:26 +02:00
|
|
|
% varlist = '';
|
2017-05-16 12:42:01 +02:00
|
|
|
for j=1:length(GlobalNames)
|
2010-01-26 14:18:15 +01:00
|
|
|
eval(['global ',GlobalNames{j},';']);
|
|
|
|
eval(['fGlobalVar.',GlobalNames{j},'=',GlobalNames{j},';']);
|
|
|
|
end
|
|
|
|
|
2017-05-16 12:42:01 +02:00
|
|
|
if nargin<2
|
2010-01-26 14:18:15 +01:00
|
|
|
save(fname,'fGlobalVar');
|
|
|
|
else
|
|
|
|
save(fname,'fGlobalVar','-append');
|
|
|
|
end
|