There seems to be a problem with the addvertex function in R2022a. It works fine in R2021a.
There is a problem in how I can add new vertices to an existing model, where this is some inconsistency in passing 2D and 3D vertices to the addVertex function.
Sometimes, it seems there is a problem on how the function wants 2D inputs and sometimes 3D inputs.
Here's a sample. How can it take the first vertex and not the second one?
pgon = polyshape([1 1 2 4], [1 4 4 1]);
tr = triangulation(pgon);
pdmodel = createpde;
g = geometryFromMesh(pdmodel, tr.Points', tr.ConnectivityList');
addVertex(g,'Coordinates',double([1.66,4.00; 1.33,4.00])); % This works
addVertex(g,'Coordinates',double([1.00,3.00; 1.00,2.00])); % This throws an error
Error using pde.DiscreteGeometry/addVertex
Coordinates value must be a 3-column double matrix not containing Inf, NaN, or complex numbers.

5 commentaires

Kangming Xu 10/181
Kangming Xu 10/181 le 20 Juil 2022
Thank you for reaching out to us.
I successfully reproduced the issue in MATLAB R2022a and reported the issue to our development team. Please let me know if you have any questions in the meantime!
Allan
Allan le 21 Juil 2022
Is there any workaround for this? I need to add a vertex to a Geometry model.
Also, if the bug gets fixed. Will it be done in R2022b?
Kangming Xu 10/181
Kangming Xu 10/181 le 21 Juil 2022
Modifié(e) : Kangming Xu 10/181 le 21 Juil 2022
A possible workaround from me is to add each vertex one by one. Please let me know whether it works for you or not. For example,
pgon = polyshape([1 1 2 4], [1 4 4 1]);
tr = triangulation(pgon);
pdmodel = createpde;
g = geometryFromMesh(pdmodel, tr.Points', tr.ConnectivityList');
addVertex(g,'Coordinates',[1.66,4.00]);
addVertex(g,'Coordinates',[1.33,4.00]);
addVertex(g,'Coordinates', [1.00,3.00]);
addVertex(g,'Coordinates',[1.00,2.00]);
pdegplot(g, 'VertexLabels', 'on','FaceAlpha',0.5);
Allan
Allan le 22 Juil 2022
Modifié(e) : Allan le 22 Juil 2022
Yes that works! My full code is working now.
Thank you for your suggestion @Kangming
xl z
xl z le 11 Juin 2024
How to add points on a cylindrical surface? It will prompt an error-“Specified point too far from the boundaries.”

Connectez-vous pour commenter.

 Réponse acceptée

Allan
Allan le 25 Juil 2022

0 votes

@Kangming had give a workaround to this bug. Adding a vertex one by one seems to not have pose any issues with the addVertex( ) function.

Plus de réponses (0)

Question posée :

le 18 Juil 2022

Commenté :

le 11 Juin 2024

Community Treasure Hunt

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

Start Hunting!

Translated by