MATLAB Answers


copy uipanel content to clipboard

Asked by michael
on 2 Dec 2012


l have a uipanel containing multiples Axes to copy the content of the uipanel to clipboard ? for now l'm using a snipping tool, not convenient.

tried and searched for Print option, couldn't find anything.





No products are associated with this question.

2 Answers

Answer by Richard Quist
on 3 Dec 2012

Have you tried, from the MATLAB command line or within a function or script:

     print(fig, '-dmeta') 

where fig is the figure that contains your content?


I seem to remember from the source that the FEX contribution export_fig can do this kind of copying automatically.

thanks for your inputs, l tried the Copyobj, and copy the whole uipanel to a new figure but then the figure is not autofitting to the uipanel, could do it manually but takes away the benefit of the automation. Tried export_fig(), really nice finction but can not pass the uipanel, send a message to the author.

thanks again,


get() the Position of the uipanel and set() it as the Position of the new figure before doing the copyobj(). You might have to temporarily set() the Units of the uipanel to pixels before get()'ing the Position.

Answer by Walter Roberson
on 3 Dec 2012

Sometimes what has to be done is to create a second figure, copyobj() the graphics into the new figure, and print() or saveas() or export_fig the new figure.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!