Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
Hello,
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 ?
Thanks,
Anatole Jimenez
  3 Commenti
Anatole Jimenez
Anatole Jimenez il 22 Mar 2019
Here is the error for the following instruction :
function mask = drawplaque(app)
h2 = impoly(app.UIAxes);
mask = h2.createMask;
end
The error (quite long) :
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Error using matlab.ui.control.UIAxes/get
There is no CurrentPoint property on the UIAxes class.
Error in getCurrentPoint (line 10)
p = get(h,'CurrentPoint');
Error in impoly>impolyAPI/animateLine (line 577)
[x_init,y_init] = getCurrentPoint(h_axes);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using matlab.ui.internal.controller.FigureController/handleEvent (line 300)
Error while evaluating Figure WindowButtonMotionFcn.
Anatole Jimenez
Anatole Jimenez il 22 Mar 2019
For this draw polygon :
function mask = drawplaque(app)
h2 = drawpolygon(app.UIAxes);
end
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.

Accedi per commentare.

Risposte (2)

Harshita Gupta
Harshita Gupta il 28 Mar 2019
Hello,
If you are using version R2018b or earlier then try mapping the current point of a UIFigure to the UIAxes.Should probably help.
  1 Commento
Anatole Jimenez
Anatole Jimenez il 28 Mar 2019
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' ?

Accedi per commentare.


Pietro Prestininzi
Pietro Prestininzi il 7 Feb 2020
Having the same problem here, version 2019b.
News on the topic?
  2 Commenti
Anatole Jimenez
Anatole Jimenez il 7 Feb 2020
Hello Pietro,
Unfortunately I didn't find any solution at that time so I used an alternative.
I just open a new figure window when calling for a draw and repeat my figure on it.Then I use the function drawpolygon as it works on non-GUI figure.

Accedi per commentare.

Categorie

Scopri di più su Develop uifigure-Based Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by