Many of you may know Adam from both File Exchange and MATLAB Answers. On File Exchange, he is an author of many high-quality entries, with 3 Pick of the Week selections.
copyUIAxes is one of those functions that has a clear need but is quite daunting to tackle because of the complexity. The idea started from this thread on MATLAB Answers, " How can I save a figure within app designer?" You can see that there was quite an active discussion around the quesiton and solutions. It turns out that the function copyobj, which lets you copy graphics objects from one parent handle to another, does not work with uiaxes. uiaxes is a (relatively) new type of graphics object that came about with the introduction of App Designer. It is different from the traditional axes, and some of the commands that work with the legacy graphics system do not work with the new graphics objects. copyobj is one of those commands.
Copying objects from a uiaxes allows you to display the content on a traditional axes, and that lets you easily save, print, or modify the graph. The challenge is that many axes properties are "hidden, obscured, read-only, or vary between Matlab releases", as Adam mentions in the description. If you look at his code, he has lots of validation, error-checking, special cases, and other techniques to be as general and multi-release compatible as possible.
I also encourage you to take a look inside the code, as Adam includes some details about the code as well as the complexity of the task.
Adam mentions this in the File Exchange entry page, but in R2020a, there are two new functions copygraphics and exportgraphics that let you copy or save your graphs created in uiaxes. But nonetheless, his copyUIAxes is valuable for people using older releases.
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。