MATLAB: Are graphics supported with MATLAB Builder for COM 1.1 (R14) or MATLAB Builder for Excel 1.2 (R14)

buildercomfiguregraphicgraphicsMATLAB Builder for COMobjectplot

I have created a COM object that generates a figure as one of its methods. However, when I call this method from my Visual Basic or VBA code, the figure is unresponsive. That is, if it is a GUI, none of the user input controls trigger callbacks, and if it’s a typical MATLAB figure, none of the toolbar options work.

Best Answer

This problem has been fixed in MATLAB Builder for COM 1.1.2 (R14SP1) and MATLAB Builder for Excel 1.2.2 (R14SP1) with a new compile option. The cause of the problem is that MATLAB Component Runtime is destroyed when the end of a macro is reached but the figure window is not. This results in the figure being unresponsive because the MCR is not available to interpret callback events. The solution to this problem is a feature which allows the MCR to remain open until the component is unloaded. In order to invoke this option, select "Create a singleton MCR" from the COMTOOL New Project Settings, or use the -S flag if compiling with MCC.
If you are using a previous version of MATLAB Builder for COM or MATLAB Builder for Excel, there is no workaround.