Hello!
I encountered the following error in MATLAB 2016:
Error using writetable (line 117)
Unable to write to file 'file.xlsm'. Ensure the file is a valid spreadsheet file and is not password protected.
Error in policy_transition (line 37)
writetable(result2, template_name, 'WriteVariableNames', true, 'WriteRowNames', true, 'Sheet', 'Sheet1');
However, this error does not occur in MATLAB 2024.
We’ve thoroughly checked the Excel file – it’s definitely not corrupted or password-protected.
Could you please advise if there’s any way to fix or work around this issue in the 2016 version of MATLAB?