How to plot an alphaShape to a specific axes in app designer
4 views (last 30 days)
Show older comments
Mustafa Al Homsi
on 18 Mar 2019
Commented: Mustafa Al Homsi
on 18 Mar 2019
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 Comments
Accepted Answer
Steven Lord
on 18 Mar 2019
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)
More Answers (0)
See Also
Categories
Find more on Bounding Regions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!