How to respond to update of axis data?

3 Ansichten (letzte 30 Tage)
bethel o
bethel o am 6 Okt. 2022
Kommentiert: bethel o am 7 Okt. 2022
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

Akzeptierte Antwort

Eric Delgado
Eric Delgado am 6 Okt. 2022
Bearbeitet: Eric Delgado am 6 Okt. 2022
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!"
  1 Kommentar
bethel o
bethel o am 7 Okt. 2022
How do you acquired this kind of Jedi skills?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by