How to use Events and Addlistener to Update Ylim

3 ビュー (過去 30 日間)
Kat Lee
Kat Lee 2018 年 1 月 3 日
コメント済み: Kat Lee 2018 年 1 月 9 日
Hey, guys, I've been stuck for this issue for a really long time.
All I want to do is to create a event and listener, which allow me to update my ylim among several different functions to current one ( there is one big function set the ylim in gui, and this big function is calling several functions outside it. Those been called functions are calculated some variable based on a fixed ylim value, their ylim won't update as my big function's ylim changed)
Maybe this is a very simple one, but it took me really long to figure out.
I have also attached my "try" code, it's not completed, but I hope it can give you a rough idea about what I am trying to do.
classdef axesChangedNotifier < handle
events
XLimChanged
YLimChanged
end
methods (Static)
function createListener(~)
h = gca;
obj = addlistener(h,'PostSet',@updYlim);
end
function UpdYlim(obj) % allow user to update ylim
end
end
Thank you so much
  2 件のコメント
Kat Lee
Kat Lee 2018 年 1 月 9 日
Thanks for the example link, but I've found that I am still confused. Right now, I am thinking to let event's obj = main function that change ylim, and grab the axes handle, and let other function call this based on listener. But I am still stuck for how to realize it.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeConstruct and Work with Object Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by