Merge branch 'xlwrite' into 'master'

WriteShockDecomp2Excel.m: only use xlwrite if xlswrite fails

Closes #1575

See merge request Dynare/dynare!1662
time-shift
Sébastien Villemot 2019-09-24 11:16:37 +00:00
commit 3237cd4684
1 changed files with 8 additions and 3 deletions

View File

@ -114,10 +114,15 @@ for j=1:nvar
end
warning off
if ~ismac
try
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,'_shock_decomposition',fig_mode,fig_name1],d0,endo_names{i_var(j)});
else
[STATUS] = xlwrite([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
end
warning on