필터 지우기
필터 지우기

refresh gui axes if wanted

조회 수: 8 (최근 30일)
Szilvia
Szilvia 2012년 4월 21일
Hi,
I have an axes on my GUI. can set some parameters on it and I have a "refresh" button and a checkbox for "refresh automatically". If the checkbox is checked, the plot should change whenever the user sets something (wether to show color bar, if the plot is faceted / flat shaded ect.)
I have found some suggessions for timer but this is surely not the correct solution for this. In other programming languages I would call the "refresh button" callback if the checkbox is checked but I am new to matlab and I can not find how to achive the same result. What expressions should I look for? Is there some way of linking object events?
thanks
Szilvia

답변 (2개)

Image Analyst
Image Analyst 2012년 4월 21일
If the user changed something so that your plotted data changed, (like the x or y values) then you need to call the function (plot, bar, pie, plotyy, whatever) again to update it with the new data.
If the appearance of the plot (like the title, xlabel, size, whatever) was supposed to change, then it should change right away.
The only time when replotting or changing appearance won't work right away is if you're in some intensive loop that's going so fast and furious that the "behind the scenes" message to update/refresh your plot (or image or axes) never gets acted upon. In that situation you can call " drawnow" inside your loop to force it to update on each loop iteration.

Paul
Paul 2012년 4월 22일
A long way to do it would be writing an if statement for each button that could be pressed. This is a bit of a hassle though. And is not a very good way to do it. What exactly are you doing?

카테고리

Help CenterFile Exchange에서 Axes Appearance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by