Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Steven Lord
Steven Lord am 18 Mär. 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)

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by