How to use Events and Addlistener to Update Ylim
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Vishwas Kumar
2018년 1월 9일
편집: Vishwas Kumar
2018년 1월 9일
Have a look at the example here: https://www.mathworks.com/help/matlab/matlab_oop/example-using-events-to-update-graphs.html#burmsmc-1
Intro to events and listeners: https://www.mathworks.com/help/matlab/matlab_oop/events-and-listeners-syntax-and-techniques.html
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Events에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!