Saving GUI as .jpg in matlab

714 views Asked by At

In matlab, I have created a GUI with several plots and edit boxes filled with text for an experiment with the bike. These plots and edit box values vary depending on the data I input (120 different sets). I was able to save the GUI as a figure with

    saveas(handles.speedbike,fullfile(savename), 'fig');

Speedbike is the handle I gave to one of the plots and savename is the name that the figure is saved under, which changes with each set. Now I also wish to save all the sepparate GUI's as jpegs, but using the same code as above, but with 'jpg' instead of 'fig' only saves a small corner of the figure as a jpeg, not the whole GUI.

Is there any function that I can use to correctly save a gui as a jpeg, or any way to open a .fig file, and then saving a copy of that as a jpeg.?

2

There are 2 answers

0
am304 On

You need to use the handle of the whole figure for your GUI, instead of the handle of one of the plots. You probably also want to use print for saving to jpg.

0
Brethlosze On

Ive found satisfactory results with this:

hg=get(0,'Children');
saveas(hg,'.\gui.fig','fig');
optsave.Format='png';
hgexport(hg,'.\gui.png',optsave);

Why this do not work?. This normally do with normal figures, and failed with GUI's:

optsave.Format='meta';
hgexport(hg,'.\gui.wmf',optsave);