필터 지우기
필터 지우기

How can I get the minimum and maximum value of the xaxis when I zoom in on a plot?

조회 수: 28 (최근 30일)
Is it possible to define a callback when I zoom in on the plot and get the minimum and maximum x values from the plot? Kindly request you to give an example.
Thanks in Advance.

채택된 답변

Image Analyst
Image Analyst 2014년 8월 28일
Have you looked at the xlim() function?
  댓글 수: 2
matlablearner
matlablearner 2014년 8월 28일
I got the answer. I used the ActionPostCallback Function
function ZoomTag_OnCallback(hObject, eventdata, handles)
h = zoom(handles.axes1); set(h,'ActionPostCallback',@mypostcallback); set(h,'Enable','on');
%Occurs after mouse button up for zoom function function mypostcallback(obj,evd) global newLim; newLim = get(evd.Axes,'XLim');
Image Analyst
Image Analyst 2014년 8월 28일
Yep, like I thought. But if evd.Axes or handles.axes1 is the current axes, you can simply to
newLim = xlim();
which is simpler. If it's not the current axes, you can do
newLim = xlim(handles.axes1);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by