The Matlab code that we wish to run reads in an “input.xls” file, performs calculations in Matlab .m modules, then outputs results to an “output.xls” file. There is an Excel VBA macro in a separate workbook that populates the “input.xls” file before calling the Matlab .m file with the following code:
Dim MatLab As Object
Set MatLab = CreateObject("Matlab.Application")
MatLab.Execute (“PATH TO MATLAB.m”)
The Matlab code should then populate the “output.xls” file (using xlswrite functions) with the final results once the run is complete. The Matlab code now fails to write to the “output.xls” file. There is evidence that the Excel macro is successfully calling the Matlab code since the Matlab application is opening in the background and running for the expected amount of time. However, the instance of Matlab is not visible and without the “output.xls” file, there is no way to diagnose the potential errors. Also, please note that run from the Matlab command line, the Matlab code populates the “output.xls” file perfectly so there should be no issues with the Matlab code.
Any help would be much appreciated!