How to plot an alphaShape to a specific axes in app designer
조회 수: 3 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!