Home > matlab > parallel > struct2local.m

struct2local

PURPOSE ^

PARALLEL CONTEXT

SYNOPSIS ^

function struct2local(S)

DESCRIPTION ^

 PARALLEL CONTEXT
 In a parallel context, this function will create, in the workspace of the calling function,
 as many variables as there are fields in the structure, assigning
 them the value of the fields.

 INPUTS
  o S [struc]   This structure possibly containing several fields ...
  
  OUTPUTS
  None

 Copyright (C) 2009-2010 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 struct2local(S)
0002 % PARALLEL CONTEXT
0003 % In a parallel context, this function will create, in the workspace of the calling function,
0004 % as many variables as there are fields in the structure, assigning
0005 % them the value of the fields.
0006 %
0007 % INPUTS
0008 %  o S [struc]   This structure possibly containing several fields ...
0009 %
0010 %  OUTPUTS
0011 %  None
0012 %
0013 % Copyright (C) 2009-2010 Dynare Team
0014 %
0015 % This file is part of Dynare.
0016 %
0017 % Dynare is free software: you can redistribute it and/or modify
0018 % it under the terms of the GNU General Public License as published by
0019 % the Free Software Foundation, either version 3 of the License, or
0020 % (at your option) any later version.
0021 %
0022 % Dynare is distributed in the hope that it will be useful,
0023 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0025 % GNU General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License
0028 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0029 
0030 
0031 vnam = fieldnames(S);
0032 
0033 for j=1:length(vnam),
0034     assignin('caller',vnam{j},getfield(S,vnam{j}));
0035 end

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