How to draw shapes in uiaxes on app designer?

71 次查看(过去 30 天)
I need to put a square in the middle of my 100x100 uiaxes on app designer. I tried using
rectangle(‘Position’,[25,25,50,50])
But that just creates a new window when I click run. The shape needs to be in the axes.

采纳的回答

Marek Balaz
Marek Balaz 2018-5-2
Hello, try to use
rectangle(app.UIAxes, 'Position', [25,25,50,50])
  3 个评论
shahzeb ali
shahzeb ali 2018-10-4
hey how to draw a circles with different color in app designer???
Marek Balaz
Marek Balaz 2018-10-4
Hey for drawing circles you can use rectangles with 'Curvature' set to [1 1] which will round corners of rectangle and you can achiev circle. Try to use:
rectangle(app.UIAxes, 'Position', [25,25,50,50], 'Curvature', [1 1])

请先登录,再进行评论。

更多回答(1 个)

Steven Kaplan
Steven Kaplan 2019-4-1
编辑:Steven Kaplan 2019-4-1
Has anyone successfully used the viscircles function in app designer? I am getting the following error:
Error using uistack (line 53)
Functionality not supported with figures created with the uifigure function. For more information, see Graphics Support in App Designer.
Error in viscircles (line 165)
uistack(thinCircHdl,'up');
  5 个评论
arisha mehar
arisha mehar 2020-8-29
Or any alternate method u've used to visuaize circles? plzz tell me
Hasaan Ijaz
Hasaan Ijaz 2020-8-30
编辑:Hasaan Ijaz 2020-8-30
I couldn't figure out how to use the viscircles but the rectangle function can do the same job.
By using the following for loop you will ensure that all detected circles are highlighted/filled
circlesize = 15;
cs = circlesize;
for i=1:max(size(centers))
rectangle('Parent', axisofinterest,'Position',[centers(i,:) -cs cs cs], 'Curvature',[1,1]);
end
This should work. You will obviously have to tweak the positioning parameters. Still, the viscircles is more desirable bcz its faster. If you figure out to incorporate viscircles, lemme know.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by