Hold plot for several different cases

조회 수: 1 (최근 30일)
Frank
Frank 2015년 2월 3일
댓글: Titus Edelhofer 2015년 2월 3일
Hi, I have created a GUI where a case is selected from a popup menu, points are calculated according to this case and a plot is drawn once a button "START" is pushed. I would now like to hold plots each time the button START is pushed, i.e. I want to be able to compare the plots between different cases.
This is what my function file looks like:
function [ ] = plot_calc(x, y, z, name, color, handles )
plot(handles.plot,x,y,'DisplayName',name,'Color',color);
box(handles.plot,'on');
grid(handles.plot,'on');
%hold(handles.plot,'all');
xlabel(handles.plot,'Axis(mm)','FontSize',10);
ylabel(handles.plot,'Deformation','FontSize',10);
Where do I have to insert the hold-command? Or what do I have to do to keep the graphs?
Thank you!!

답변 (2개)

Titus Edelhofer
Titus Edelhofer 2015년 2월 3일
Hi,
the simplest would be to add after the plot command:
plot(handles.plot,x,y,'DisplayName',name,'Color',color);
hold(handles.plot, 'on');
Titus

Frank
Frank 2015년 2월 3일
Thanks for the answer. Unfortunately, the plot is still overwritten once I hit the Start-Button. There might be another piece of code that disables holding in the rest of my script. What would be a typical command I would have to look for?
Thanks.
  댓글 수: 3
Frank
Frank 2015년 2월 3일
Hi, at one point in the script, the command cla(...) cleared the axes. Since I didn't write the code myself, I missed it while looking through the script. Everything is now working. Thanks!
Titus Edelhofer
Titus Edelhofer 2015년 2월 3일
Jepp, forgot to add cla to the list above ;-). If everything works, you might mark the question as answered then ...
Titus

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by