Home > matlab > parallel > storeGlobalVars.m

storeGlobalVars

PURPOSE ^

PARALLEL CONTEXT

SYNOPSIS ^

function storeGlobalVars(fname,append)

DESCRIPTION ^

 PARALLEL CONTEXT
 In a parallel context, this function stores all global vars in structure 
 fGlobalVar and saves it in the file fname.mat

 INPUTS
 fname  [str]         name of the file

 append []                        flag to append globals to the storage file

 OUTPUTS
 None


 Copyright (C) 2009-2011 Dynare Team

 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
 along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function storeGlobalVars(fname,append)
0002 % PARALLEL CONTEXT
0003 % In a parallel context, this function stores all global vars in structure
0004 % fGlobalVar and saves it in the file fname.mat
0005 %
0006 % INPUTS
0007 % fname  [str]         name of the file
0008 %
0009 % append []                        flag to append globals to the storage file
0010 %
0011 % OUTPUTS
0012 % None
0013 %
0014 %
0015 % Copyright (C) 2009-2011 Dynare Team
0016 %
0017 % This file is part of Dynare.
0018 %
0019 % Dynare is free software: you can redistribute it and/or modify
0020 % it under the terms of the GNU General Public License as published by
0021 % the Free Software Foundation, either version 3 of the License, or
0022 % (at your option) any later version.
0023 %
0024 % Dynare is distributed in the hope that it will be useful,
0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 % GNU General Public License for more details.
0028 %
0029 % You should have received a copy of the GNU General Public License
0030 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0031 
0032 
0033 GlobalNames = who('global');
0034 % varlist = '';
0035 for j=1:length(GlobalNames);
0036     eval(['global ',GlobalNames{j},';']);
0037     eval(['fGlobalVar.',GlobalNames{j},'=',GlobalNames{j},';']);
0038 end
0039 
0040 if nargin<2,
0041     save(fname,'fGlobalVar');
0042 else
0043     save(fname,'fGlobalVar','-append');
0044 end

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005