CLA to Clear Out Axes Not Working in Slider Callback Function
3 次查看(过去 30 天)
显示 更早的评论
Hello Everyone!
I am developing an app to process and analyze vasodilation data and I have spent several days trying to fix the following two issues. Your help will be appreciated.
1) I am using a slider to go from one frame of the dataset to another. The slider updates all the graphs shown in the screenshot below. At first, the app updates the graphs pretty fast but the more I use the slider to update the graphs, the slower the app gets. I think that this is happening because the graphs are not cleared out before they are updated by the slider. You can see that this on the top graph in the screenshot below. The red markers of previously displayed graphs (highlighted with magenta) are not cleared out after choosing a different frame. I have tried to use cla in the callback function before plotting the new graphs but this does not work. Any insights about what I can do to clear out the graphs before plotting the new ones with the slider?
2) The second issue is a minor one but I would like to get it fixed. Every time I use the slider to go from one frame to another, the colorbar and the x and y titles of the graph on the left are shown on the left lower corner of the screen before being properly shown in the right place (See what is highlighted with magenta in the screenshot below) How can I fix this?
If you need to see my script, let me know. I am more than happy to share it or share parts of it. Thank you so much for your attention!
2 个评论
Cris LaPierre
2023-6-17
How are you clearing your axes? Yes, please share your code. It is much easier to help if we can see what you are doing.
采纳的回答
Walter Roberson
2023-6-17
If you have performance issues, then you should be re-working your graphics a fair bit.
For performance, create your axes and titles and graphic objects once, and then as you go through the loop, update the graphics objects as needed. That might be something like
h = plot(nan,nan); %initialize
while true
stuff
set(h, 'XData', new_x_values, 'YData', new_y_values);
drawnow limitrate
end
Creating new graphics objects is a lot more expensive than updating the properties of existing graphics objects.
3 个评论
Walter Roberson
2023-6-17
The uiaxes, uipanel, various uilabel -- all of those can be created in advance, possibly set Visible off at the beginning. Then as you get new data, update only the properties needed
更多回答(0 个)
另请参阅
类别
在 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!