Im using plotyy to display a 2-variable graph in a matlab GUI I built. I would like the graph to clear every time I hit a button, so the first line in the callback function is "cla reset", but it's not working and I have no idea why. Can anyone help me out? Thanks.

 채택된 답변

Walter Roberson
Walter Roberson 2014년 3월 15일

0 개 추천

댓글 수: 3

Franco
Franco 2014년 3월 15일
Not sure on how that helps me. I want to plot 2 graphs on the same plot, each graph with its own y axis label. The link specifies that the user wants to show plots on different graphs.
Your "cla reset" is probably not operating on the axes you think it is. You should be using an explicit axes argument in the call,
cla(TheAxes, 'reset')
It is recommended that you give the parent object (axes, figure) for every graphics operation instead of relying on MATLAB "knowing" which one you are working on. For example,
plot(TheAxes, x, y)
instead of
plot(x, y)
Franco
Franco 2014년 3월 16일
What you suggest is exactly what Im doing. The GUI has 2 plots, so I have to tell which graph to plot on [plotyy(handles.axes1,x,y1,x,y2)] I tried clearing the graphs using what you suggest, [cla(TheAxes, 'reset')], but the problem is that the statement goes at the beginning of the function, where the axes is not defined until the middle of the function. My goal is for the the function, before executing any of the script to clear all graphs at [cla reset] doesn't seem to be doing it for some reason.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Two y-axis에 대해 자세히 알아보기

태그

질문:

2014년 3월 15일

댓글:

2014년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by