필터 지우기
필터 지우기

How to plot an alphaShape to a specific axes in app designer

조회 수: 3 (최근 30일)
Mustafa Al Homsi
Mustafa Al Homsi 2019년 3월 18일
댓글: Mustafa Al Homsi 2019년 3월 18일
I need to plot an alphaShape to an axes component I have in my app. I am able to plot an array of points like usual given the code below:
x = rand(10,1);
y = rand(10,1);
plot(app.UIaxes1,x,y);
However, when I attempt to plot an alphaShape, I get the following error:
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
The code I am using to debug this is below:
x = rand(10,1);
y = rand(10,1);
shape = alphaShape(x,y);
plot(app.UIaxes1,shape);
If I remove the "app.UIaxes1" argument and just type "plot(shape);", I am able to plot the alphaShape but it will show in a seperate figure and not inside my app screen.

채택된 답변

Steven Lord
Steven Lord 2019년 3월 18일
The plot method of alphaShape objects does not accept an axes handle as its first input. Instead you'll need to specify the uiaxes handle as the value for the 'Parent' property of the patch that the plot method of alphaShape will return. First make some data and use that to create an alphaShape.
x = rand(10,1);
y = rand(10,1);
shape = alphaShape(x,y);
Now as part of this example I create a uiaxes, but you have a uiaxes in your app that you can use instead.
ax = uiaxes;
Finally plot the shape.
plot(shape, 'Parent', ax)
  댓글 수: 1
Mustafa Al Homsi
Mustafa Al Homsi 2019년 3월 18일
Thank you Steven for the quick responce. This works perfect. Mustafa

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by