How can I draw interactively a polygon on axes in App designer ?

조회 수: 6(최근 30일)
I am making an app on App designer and I need to be able to draw interactively a polygon on an image display on an axes.
I already tried imploy, roipoly and drawpolygon functions with 'app.UIAxes' as 'ax' parameter but none of them seem to be accepted by App designer.
Can someone help me ?
Anatole Jimenez
  댓글 수: 3
Anatole Jimenez
Anatole Jimenez 2019년 3월 22일
For this draw polygon :
function mask = drawplaque(app)
h2 = drawpolygon(app.UIAxes);
This error :
Error using images.roi.internal.ROI/parseInputs
ROI parent must be a valid Axes object.
Error in images.roi.Polygon
Error in drawpolygon (line 155)
h = images.roi.Polygon(varargin{:});
Error in app2/drawplaque (line 84)
h2 = drawpolygon(app.UIAxes);
Error in app2/DrawnewplaqueButtonPushed (line 151)
mask = drawplaque(app);
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.

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


Harshita Gupta
Harshita Gupta 2019년 3월 28일
If you are using version R2018b or earlier then try mapping the current point of a UIFigure to the UIAxes.Should probably help.
  댓글 수: 1
Anatole Jimenez
Anatole Jimenez 2019년 3월 28일
Thank you for the answer Harshita Gupta.
I didn't quite understand, can you give an example for a UIFigure, 'fig1' and a UIAxes 'ax1' ?

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

Pietro Prestininzi
Pietro Prestininzi 2020년 2월 7일
Having the same problem here, version 2019b.
News on the topic?
  댓글 수: 2

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


Find more on Maintain or Transition figure-Based Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by