Bug in write_xls option of shock_decomposition after estimation

Dear Dyanre developers,

I am running Dynare 4.5.3 on Matlab 2016b / MacOS. There is possible a bug in the file WriteShockDecomp2Excel.m as below:

Blockquote
warning off
if ~ismac
[STATUS,MESSAGE] = xlswrite([DynareModel.fname,‘_shock_decomposition’,fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
else
[STATUS] = xlwrite([DynareModel.fname,‘_shock_decomposition’,fig_mode,fig_name1],d0,deblank(endo_names(i_var(j),:)));
end
warning on

It raised an error when I run shock_decomposition after estimation with write_xls option.

I think xlwrite should be xlswrite. Please correct it if it is actually a bug.

Best regards,

You can find the xlwrite function at

But I agree it is not ideal to rely on that file before even checking whether Excel is installed.

Many thanks Prof Johannes. I don’t know why Matlab 2016b cannot recognize my installed excel 365, the external xlwrite provides an alternative.
Best,