Since R2019b

## Syntax

``VertexID = addVertex(g,"Coordinates",Coords)``

## Description

example

````VertexID = addVertex(g,"Coordinates",Coords)` adds a new isolated vertex at the point with coordinates `Coords` to a boundary of the geometry `g`. To add several vertices simultaneously, specify `Coords` as an `N`-by-2 matrix for a 2-D geometry or an `N`-by-3 matrix for a 3-D geometry. Here, `N` is the number of new points.If a point with the specified coordinates is slightly offset (within an internally specified tolerance) from a geometry boundary, `addVertex` approximates it to a point on the boundary. If a vertex already exists at the specified location, `addVertex` returns the ID of the existing vertex instead of creating one.```

## Examples

collapse all

Use `addVertex` to add a single vertex and multiple vertices on a side of a block geometry.

Create a PDE model.

`model = createpde();`

Import the geometry.

`g = importGeometry(model,"Block.stl");`

Plot the geometry and display the vertex labels.

`pdegplot(g, "VertexLabels", "on","FaceAlpha",0.5)` Add a vertex on the edge of a block.

`VertexID = addVertex(g,"Coordinates",[20 0 50])`
```VertexID = 9 ```

Plot the geometry and display the vertex labels.

`pdegplot(g, "VertexLabels", "on","FaceAlpha",0.5)` Add three more vertices on the same edge of the block.

```V = ([40 0 50; 60 0 50; 80 0 50]); VertexIDs = addVertex(g,"Coordinates",V)```
```VertexIDs = 3×1 10 11 12 ```

Plot the geometry and display the vertex labels.

`pdegplot(g, "VertexLabels", "on","FaceAlpha",0.5)` Add a vertex at the corner of the block. Since there is already a vertex at the corner, `addVertex` does not create a new vertex, but returns the ID of the existing vertex.

`VertexID = addVertex(g,"Coordinates",[100 0 50])`
```VertexID = 5 ```

## Input Arguments

collapse all

Geometry, specified as an `fegeometry` object or a `DiscreteGeometry` object. For more information, see `fegeometry` and DiscreteGeometry Properties.

Coordinates of a new vertex, specified as an `N`-by-2 or `N`-by-3 numeric matrix for a 2-D or 3-D geometry, respectively. Here, `N` is the number of new vertices.

Example: `"Coordinates",[0 0 1]`

Data Types: `double`

## Output Arguments

collapse all

Vertex ID, returned as a row vector of positive numbers. Each number represents a vertex ID. When you add a new vertex to a geometry with `N` vertices, the ID of the added vertex is `N + 1`. If a vertex already exists at the specified location, `addVertex` returns the ID of the existing vertex.

## Version History

Introduced in R2019b

expand all
{"ft_lang_label":"__label__en","ft_lang_prob":0.65083855,"math_prob":0.9130802,"size":2902,"snap":"2023-14-2023-23","text_gpt3_token_len":744,"char_repetition_ratio":0.17805383,"word_repetition_ratio":0.14058957,"special_character_ratio":0.23604411,"punctuation_ratio":0.13553114,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9987683,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-06-10T07:02:04Z\",\"WARC-Record-ID\":\"<urn:uuid:14769da3-be25-45ee-acbd-122268c41197>\",\"Content-Length\":\"92605\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a15ef73d-db74-43d7-8340-ee2762dd431c>\",\"WARC-Concurrent-To\":\"<urn:uuid:3c32b800-2894-4763-a0b3-17db8a078b8d>\",\"WARC-IP-Address\":\"104.86.80.92\",\"WARC-Target-URI\":\"https://nl.mathworks.com/help/pde/ug/pde.discretegeometry.addvertex.html\",\"WARC-Payload-Digest\":\"sha1:CKDWDD7D7IVIVK4M4NZOD3UQUITGTT7D\",\"WARC-Block-Digest\":\"sha1:3TXZYEBY5EUKELDLFSALGIFRUCI2P4AQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224657144.94_warc_CC-MAIN-20230610062920-20230610092920-00039.warc.gz\"}"}