How can I save plots in GUI ?

Hi. I am currently working on embeding a plot in GUI. I want to see the plot inside the gui interface not in the figure box. I achieved to embed the figure into the interface but when I also want to save it by saveas the image i get turns out to be depending on the position of the axes in the gui workspace. I mean if I slide axes trough the edges of the workspace I get no image or if I approach it to the edges I might get half of the plot from the file where the plot is saved. The following code does what I provided above. All help that you are going to provide is well appreciated.
"""""
function pushbutton1_Callback(hObject, eventdata, handles)
axes(handles.axes1);
box(gca,'on');
A=[1 2 3 4 5 6];
B=[0 1 0 -1 0 1];
plot(A,B)
saveas(gcf,['STEP' num2str(1+9999) '.png'],'png');
""""""

1 comentario

Ragunanth Venkatesh
Ragunanth Venkatesh el 2 de Ag. de 2017
fh = figure;
copyobj(handles.axes1, fh);
just use this and then u will open the figure from the gui as a seperate figure, and then you can save it using save as.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Data Exploration en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 3 de Sept. de 2013

Comentada:

el 2 de Ag. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by