필터 지우기
필터 지우기

Strange Behaviour using Zoom with app designer

조회 수: 6 (최근 30일)
Jason
Jason 2020년 11월 3일
댓글: Adam Danz 2020년 11월 4일
Hello. I have an image on a UIAxes and want to use a checkbox to either zoom in 4X, or retrun to 1x.
I have tried this:
value = app.xZoomCheckBox.Value;
switch value
case 1
zoom(app.UIAxes,'reset') % Sets baselevel zoom
zoom(app.UIAxes,4) % Zoom 4x
case 0
zoom(app.UIAxes,'out') % Return to baselevel zoom
end
with the checkboxclicked (case 1), the image does zoom in 4x.
However when I unclick the checkbox (case 0), I get the error message
Unrecognized function or variable 'firstinput'.
Error in matlab.graphics.interaction.webmodes.zoomWeb
I have also tried zooming 1x, but this did nothing.

채택된 답변

Adam Danz
Adam Danz 2020년 11월 3일
편집: Adam Danz 2020년 11월 3일
According to the documentation, the zoom() function can receive a figure handle as input, not an axes handle. Zoom is applied to the current axes within the figure.
If you call zoom(app.UIFigure,'out') with a figure handle, it works.
Note that you can change the current axes programmatically by setting
figureHandle.CurrentAxes
The weird thing is that the function breaks with axes inputs when the 'out' option is used (and maybe others) but not with 'reset' or factor values. Too bad the section of code that receives the inputs is wrapped in p-code.
  댓글 수: 4
Adam Danz
Adam Danz 2020년 11월 4일
Glad I could help!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by