fixed bug when SteadyState is not used for shock decompositions

fixed names of files, removing spaces and dots
use writetable with mac OS
time-shift
Marco Ratto 2020-10-29 18:36:07 +01:00
parent c8cd0a06ce
commit dbcdaf75a6
1 changed files with 7 additions and 9 deletions

View File

@ -28,7 +28,7 @@ function WriteShockDecomp2Excel(z,shock_names,endo_names,i_var,initial_date,Dyna
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
SteadyState=[];
SteadyState=zeros(DynareModel.endo_nbr,1);
fig_mode='';
fig_mode1='';
fig_name='';
@ -114,15 +114,13 @@ for j=1:nvar
end
warning off
try
fig_name1 = strrep(fig_name1,' ','_');
fig_name1 = strrep(fig_name1,'.','');
if ~ismac
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,endo_names{i_var(j)});
catch
if exist('xlwrite.m','file')
[STATUS] = xlwrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,endo_names{i_var(j)});
else
fprintf('\nWriteShockDecomp2Excel: could not write Excel file. It seems Excel is not installed on your machine.\n')
fprintf('Please install the free xlwrite.m from https://mathworks.com/matlabcentral/fileexchange/38591-xlwrite-generate-xls-x-files-without-excel-on-mac-linux-win\n')
end
else
writetable(cell2table(d0), [DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1 '.xls'], 'Sheet', endo_names{i_var(j)},'WriteVariableNames',false);
end
warning on