Saving a GUI screenshot - can't capture entire figure
Show older comments
I have a GUI built and would like to be able to save a screenshot of the output. I am attempting to do this as such:
saveas(gcbf,'fileName','jpg')
The issue is that when I look at the resulting jpg, it only shows the bottom left of the GUI figure. The rest is cut off.
I've had identical issues with other file types.
How do I make the file capture the entire figure?
Answers (1)
Image Analyst
on 5 Feb 2012
0 votes
Ah, our daily "how do I save a figure?" question. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
There is a reason that export_fig is the most downloaded File Exchange submission.
3 Comments
Michael Adams
on 10 Dec 2020
why would you link to a giant article without answering the question. quite pompous don't you think
Rik
on 10 Dec 2020
That page contains the answer. The anchor (the # symbol) will even move you to the correct section of the page (as long as your browser is working). I don't see why this would be pompous.
It is, however, 8 years old (almost 9). And still valid as it turns out. It is still a good idea to use export_fig instead of saveas.
Image Analyst
on 10 Dec 2020
No I don't think FAQs are pompous. The reason FAQs exist in the first place is because many people have, and ask, the same question as many others have done previously, and rather than whip out something off the top of your head, you can simply point someone to the FAQ which has been carefullly crafted over time to explain the question thoroughly, thus ensuring you won't forget anything.
Now I could have gone out to the FAQ myself and copied what was there and pasted it back here, without ever revealing the source of my information. Is that what you would have done? Or would you have some up with a new answer off the top of your head for the 10th time that week?
Pointing them to the FAQ has the extra benefit of them seeing all kind of questions that they may have in the future. Usually people (or most people I think) do not mind getting a link to a FAQ because there are lots of basic things they can learn there. If I had just pasted the FAQ entry (but not the link) here, they would never have seen all those other useful explanations. Does that make sense?
By the way, with release 2020a and later, the export_fig referred to in the FAQ can be replaced by the built-in exportgraphics() function.
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!