How can I save plots in GUI ?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Ragunanth Venkatesh
2017년 8월 2일
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!