If a MATLAB error occurs in the Excel Add-in built using Builder for Excel 1.2.6 (R2006a), can I read the error's stack information in Excel?
2 views (last 30 days)
Show older comments
I am building Add-ins using MATLAB Builder for Excel 1.2.6 (R2006a). When functions in these Add-ins are called from Excel and an error occurs within MATLAB, the original error is passed to Excel (for example "Matrix Dimensions Must Agree"). I would like to receive more detailed error information in Excel (i.e. MATLAB function names, and the line numbers where the error occurs.)
Accepted Answer
MathWorks Support Team
on 22 Jan 2010
Error messageS which contain line number information can be retrieved using the LASTERROR function in MATLAB 7.2 (R2006a), using the following method.
In the functions that you plan to deploy to Excel, wrap the MATLAB code in TRY - CATCH blocks, where the CATCH blocks return the output of the LASTERROR function (which includes line number information). As your deployed MATLAB functions will now produce multiple output arguments, you will need to slightly modify the VBA code that is automatically generated by Excel Builder to handle this in Excel. This process is described in a Related Solution below.
0 Comments
More Answers (0)
See Also
See Also
Categories
Find more on Excel Add-Ins in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!