I would like to create a png of a single panel placed in a matlab-gui, created with 'guide'. However I am able to save a screenshot of the whole GUI via
frame = getframe(specificGUIHandle); % tag of GUI-figure
imwrite(frame.cdata, 'wholeGUI.png');
But I would like to use
frame = getframe(specificPanelHandle); % tag of panel within GUI-figure
imwrite(frame.cdata, 'panel.png');
Obviously this does not work. I would like to receive a .png which simply contains a screenshot of wholeGUI.png where the panel is located. I AM able to receive the coordinates where the panel is located with
pos = getpixelposition(specificGUIHandle);
But I do not know how to use those informations...any ideas? Thanks in Advance!

 채택된 답변

Walter Roberson
Walter Roberson 2017년 10월 31일

0 개 추천

The official solution for these kinds of things is to create a new figure and copyobj the panel into the new figure and then capture the new figure.
I know that export_fig uses that strategy for some operations; I do not recall at the moment whether it handles your particular case directly; if not then I am sure Yair would consider that as an enhancement.

댓글 수: 1

Pratched
Pratched 2017년 11월 12일
Thanks a lot and sorry for the late response. I kinda figured this out couple days after and forgot to close this issue.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Yair Altman
Yair Altman 2017년 11월 12일

1 개 추천

The ScreenCapture utility does exactly what you requested.

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2017년 10월 31일

댓글:

2017년 11월 12일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by