How to designate an axes for plot in the GUI environment with a timer
조회 수: 1 (최근 30일)
이전 댓글 표시
I have two GUI figures, with one having an axes in to plot using 'plot' in a time function. However, when the second GUI window opens, the plot will get to the 2nd GUI, rather than staying in the 1st figure. If I use a command like 'openfig', it will generate an error in the timer function.
Any suggestions?
Thanks!
댓글 수: 1
David Barry
2016년 12월 6일
Have you created an axes handle and are you using it as the first input to plot? Can you share your code?
답변 (1개)
Walter Roberson
2016년 12월 6일
When you create the timer callback, pass the axes handle as one of the parameters to it.
ax = handles.axes3;
t = timer('Callback', @(src, event) MyTimerCallback(src, event, ax), ....);
function MyTimerCallback(src, event, ax)
plot(ax, ....)
댓글 수: 2
Walter Roberson
2016년 12월 6일
That should not happen with that code, not unless somehow the Parent of handles.TG_Plot gets set to the new figure.
By the way, where is PowerCurrentRead getting w from?
참고 항목
카테고리
Help Center 및 File 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!