How to respond to update of axis data?

2 次查看(过去 30 天)
I need to set a callback for when data in axis is updated. Is there a way to do this? i.e is their a way to be notified when a figure/axis/line data changes.
Thanks

采纳的回答

Eric Delgado
Eric Delgado 2022-10-6
编辑:Eric Delgado 2022-10-6
Hey @bethel o, yeah, it's possible. "YData" is not a property of figure or axes, ok?
fig = figure;
ax1 = axes(fig);
h = plot(ax1, randn(1001,1));
addlistener(h, 'YData', 'PostSet', @(~,~)disp("YData changed!"));
% Changing data...
h.YData(1) = 2*h.YData(1);
% Answer:
% "YData changed!"

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by