-
Notifications
You must be signed in to change notification settings - Fork 369
Description
TL;DR: copyobj() cannot be used to copy UIAxes (as of r2019b).
As discussed here in Matlab Central forum, the changes recently made to support UIFigure & UIAxes doesn't work. When a UIFigure is supplied as an input, the code searches for its children and uses copyobj() to copy those components to a legacy figure. When a UIAxes is directly supplied as an input, it also uses copyobj() to copy the UIAxes to the legacy figure. The problem is that copyobj() is not supported for UIAxes. As evidence of that,
uax = uiaxes();
fig = figure();
copyobj(uax,fig)
% Error using matlab.ui.control.UIAxes/copyElement
%Functionality not supported with UIAxes. For more information,
% see Graphics Support in App Designer.
The error is not thrown in export_fig() because copyobj() is called from a try/catch that rethrows the error as a modified warning.
Otherwise, export_fig() is terrific!
I recently wrote a function copyUIAxes() that searches for and copies the children of a UIAxes to a new legacy axes along with the legend and colorbar if they exist. I think this is the only workaround to using copyobj() with UIAxes.