Documentation Center

  • Trial Software
  • Product Updates

append

Class: mapshape

Append features to mapshape vector

Syntax

outShape = append(inShape,X,Y)
outShape = append(___,field,value,...)

Description

outShape = append(inShape,X,Y) appends the vector, X, to the X property of the mapshape vector, inShape, and the vector, Y, to the Y property of inShape. X and Y are either vectors of class single or double, or cell arrays containing numeric arrays of class single or double.

outShape = append(___,field,value,...) appends the values specified in value to the corresponding dynamic property, field. If the property does not exist, append adds the dynamic property to the object using the value of field for the name and assigning the field the value specified in value.

Input Arguments

inShape

mapshape vector

X

Numeric vector of planar X values

Y

Numeric vector of planar Y values

field

Field name, specified as a string. Field can specify the name of an existing property in the mapshape vector or the name you want assigned to a new property that you want to add to the mapshape vector.

value

Value you want to assign to the property specified by field, specified as a cell array, scalar, or vector of any numeric class or logical.

  • When value is a cell array, append adds the property as a Vertex property.

  • When value is a numeric array, append adds the property as a Feature property.

  • When value is empty, append removes the property.

Output Arguments

outShape

Modified mapshape vector with additional entries in X and Y fields along with any new fields for dynamic properties that you added.

Examples

expand all

Append Values to Field

Create a mapshape vector.

shape = mapshape(42:44,30:32, 'Temperature', {65:67})
shape = 

 1x1 mapshape vector with properties:

 Collection properties:
       Geometry: 'line'
       Metadata: [1x1 struct]
 Vertex properties:
              X: [42 43 44]
              Y: [30 31 32]
    Temperature: [65 66 67]

Append data representing another feature.

shape = append(shape, 42.1, 33, 'Temperature', 65.5)
shape = 

 2x1 mapshape vector with properties:

 Collection properties:
       Geometry: 'line'
       Metadata: [1x1 struct]
 Vertex properties:
  (2 features concatenated with 1 delimiter)
              X: [42 43 44 NaN 42.1000]
              Y: [30 31 32 NaN 33]
    Temperature: [65 66 67 NaN 65.5000]

Note that the mapshape vector grew from 1x1 to 2x1 in length.

See Also

|

Was this topic helpful?