Skip to content
Snippets Groups Projects
Select Git revision
22 results Searching

ReshapeMatFiles.m

Blame
  • Forked from Dynare / dynare
    Source project has a limited visibility.
    ReshapeMatFiles.m 7.46 KiB
    function ReshapeMatFiles(type, type2)
    % function ReshapeMatFiles(type, type2)
    % Reshapes and sorts (along the mcmc simulations) the mat files generated by DYNARE.
    % 4D-arrays are splitted along the first dimension.
    % 3D-arrays are splitted along the second dimension.
    %
    % INPUTS:
    %   type:            statistics type in the repertory:
    %                      dgse
    %                      irf_bvardsge
    %                      smooth
    %                      filter
    %                      error
    %                      innov
    %                      forcst
    %                      forcst1
    %   type2:           analysis type:
    %                      posterior
    %                      gsa
    %                      prior
    %    
    % OUTPUTS:
    %    none              
    %
    % SPECIAL REQUIREMENTS
    %    none
    
    % Copyright (C) 2003-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/>.
    
    global M_ options_
    
    if nargin==1, 
        MhDirectoryName = [ CheckPath('metropolis',M_.dname) filesep ];
    else
        if strcmpi(type2,'posterior')
            MhDirectoryName = [CheckPath('metropolis',M_.dname) filesep ];
        elseif strcmpi(type2,'gsa')
            if options_.opt_gsa.morris==1,
                MhDirectoryName = [CheckPath('gsa/screen',M_.dname) filesep ];
            elseif options_.opt_gsa.morris==2,
                MhDirectoryName = [CheckPath('gsa/identif',M_.dname) filesep ];
            elseif options_.opt_gsa.pprior
                MhDirectoryName = [CheckPath(['gsa' filesep 'prior'],M_.dname) filesep ];
            else
                MhDirectoryName = [CheckPath(['gsa' filesep 'mc'],M_.dname) filesep ];
            end
        else
            MhDirectoryName = [CheckPath('prior',M_.dname) filesep ];
        end  
    end
    switch type
      case 'irf_dsge'
        CAPtype  = 'IRF_DSGE';
        TYPEsize = [ options_.irf , size(options_.varlist,1) , M_.exo_nbr ];
        TYPEarray = 4;