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.

采纳的回答

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)

更多回答(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