How can I save plots in GUI ?

2 views (last 30 days)
Mehmet Özdemir
Mehmet Özdemir on 3 Sep 2013
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 Comment
Ragunanth Venkatesh
Ragunanth Venkatesh on 2 Aug 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.

Sign in to comment.

Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!