MATLAB: When I try to print a figure window that contains an ActiveX control, why is the control not printed

activeactivexfigureMATLABprintx

When I try to print a figure window that contains an ActiveX control, why is the control not printed?
I created an ActiveX control on a figure window with this command:
actxcontrol('MSFlexGridLib.MSFlexGrid.1',[30 30 200 200],figure('position',[30 30 500 500]));
But when I print the figure I get a blank page. This happens from the FILE->PRINT menu on the figure window, and when I use the PRINT command from the MATLAB command prompt. Also, when I try to print the figure to an image file the ActiveX control is only present when I use the following command:
print -dbitmap myfile.bmp

Best Answer

This is a limitation on ActiveX components on figure windows.
One known work-around on Microsoft Windows machines is to save the figure as a bitmap and then print it from an appropriate viewer.
Here is an example of how to do this:
print -dbitmap myfile.bmp
Another option is to use the GETFRAME command to create image data from the figure window. Once the image data is generated it can be displayed and printed. Here is an example of how to do this:
actxcontrol('MSFlexGridLib.MSFlexGrid.1',[30 30 200 200],figure('position',[30 30 500 500]));
[cdata, map] = getframe(gcf);
figure;
image(cdata);
colormap(map);
print;