Planar shape vector
s = mapshape()
s = mapshape(x,y)
s = mapshape(x,y,Name,Value)
s = mapshape(structArray)
s = mapshape(x,y,structArray)
A mapshape vector is an object that represents planar vector features with either point, line, or polygon topology. The features consist of X and Y coordinates and associated attributes. If these attributes vary spatially they are termed Vertex properties. These elements of the mapshape vector are coupled such that the length of the X and Y coordinate property values are always equal in length to any additional dynamic Vertex properties. Attributes which only pertain to the overall feature (point, line, polygon) are termed Feature properties. Feature properties are not linked to the autosizing mechanism of the Vertex properties. Both of the property types can be dynamically added to a mapshape vector using the standard dot notation.
A mapshape vector is always a column vector.
constructs
an empty mapshape vector, s
= mapshape()s
, with the following
default property settings.
s = 0x1 mapshape vector with properties: Collection properties: Geometry: 'line' Metadata: [1x1 struct] Vertex properties: X: [] Y: []
For an additional example see: Construct a Default mapshape Vector and Set and Add Properties
constructs
a mapshape vector and sets the s
= mapshape(x
,y
)X
and Y
property
values equal to vectors x
and y
. x
and y
may
be either numeric vectors of class single or double, or cell arrays
containing numeric vectors of class single or double. For an example,
see Construct a mapshape Vector Specifying x and y Values.
constructs
a mapshape vector from the input s
= mapshape(x
,y
,Name
,Value
)x
and y
vectors,
and then adds dynamic properties to the mapshape vector using the Name
, Value
argument
pairs.
If Value
is in a cell array containing
numeric, logical or cell array of strings, then this property is designated
as a Vertex property. Otherwise, this property is designated as a
Feature property.
If the specified Name
is Metadata
and
the corresponding Value
is a scalar structure,
then Value
is copied to the Metadata
property.
Otherwise, an error is issued.
For an example, see: Construct a mapshape vector Specifying a NameValue Pair.
constructs
a s
= mapshape(structArray
)mapshape
vector from the fields of the structure
array, structArray
.
If structArray
is a scalar structure
which contains the field Metadata
and the field
value is a scalar structure, then the Metadata
field
is copied to the Metadata
property. If structArray
is
a scalar structure and the Metadata
field is present
and is not a scalar structure, then an error is issued. If structArray
is
not scalar then the Metadata
field is ignored.
Other fields of structArray
are
assigned to s
and become dynamic properties. Field
values in structArray
that are not numeric, strings,
logical, or cell arrays of numeric, logical, or string values are
ignored.
For an example, see Construct a mapshape Vector from a Structure Array.
constructs
a new s
= mapshape(x
,y
,structArray
)mapshape
vector and sets the X
and Y
properties
equal to the numeric vectors, x
and y
,
and sets the field values of struct structArray
as
dynamic properties.
If structArray
is a scalar structure
and contains the field Metadata
, and the field
value is a scalar structure, then it is copied to the Metadata
property
value. Otherwise, an error is issued if the Metadata
field
is not a structure, or ignored if structArray
is
not scalar.
For an example, see Construct a mapshape Vector Using Cell Arrays and Structures to Define Multiple Features and Properties.

mapshape vector. 
mapshape
class is a general class that represents
a variety of planar features. The class permits features to have more
than one vertex and can thus represent lines and polygons in addition
to multipoints. The class has the following property types.
Types of Properties  Description 

Collection Properties  Collection properties contain only one value per class instance. This is in contrast to the other two property types which can have attribute values associated with each feature or with each vertex in a set that defines a feature. Geometry and Metadata are the only two Collection properties. 
Vertex Properties  Vertex properties provide a scalar number or a string for each vertex in a mapshape object. Vertex properties are suitable for attributes that vary spatially from point to point (vertex to vertex) along a line. Examples of such spatially varying attributes could be elevation, speed, temperature, or time. X and Y are vertex properties since they contain a scalar number for each vertex in a mapshape vector. Attribute values can be dynamically associated with each vertex by using dot notation. This is similar to adding dynamic fields to a structure. The dynamically added vertex property values of an individual feature match its X and Y values in length. 
Feature Properties  Feature properties provide one value (a scalar number or a string) for each feature in a mapshape vector. They are suitable for properties, such as name, owner, serial number, age, etc., that describe a given feature (an element of a mapshape vector) as a whole. Like Vertex properties, Feature properties can be added dynamically. 

The Default value for
 

Metadata is a scalar structure containing information for all the features. You can add any data type to the structure. As a Collection Property type, only one instance per object is allowed.
 

Vector of X coordinates. The values can be either a row or column vector, but are stored as a row vector. Attributes:
 

Vector of Y coordinates. The values can be either a row or column vector, but are stored as a row vector. Attributes:

append  Append features to mapshape vector 
cat  Concatenate mapshape vectors 
disp  Display mapshape vector 
fieldnames  Dynamic properties of mapshape vector 
isempty  True if mapshape vector is empty 
isfield  True if dynamic property exists 
isprop  True if property exists 
length  Number of elements in mapshape vector 
properties  Properties of a mapshape vector 
rmfield  Remove dynamic property from mapshape vector 
rmprop  Remove properties from mapshape vector 
size  Size of mapshape vector 
struct  Convert mapshape vector to scalar structure 
vertcat  Vertical concatenation for mapshape vectors 
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB^{®} documentation.
The following examples show how to build a mapshape vector by dynamically adding a single features after construction using dot (.) notation.
The following extended example adds multiple features that are both Vertex and Feature properties. It also demonstrates property behaviors when vector lengths are either changed or set to [ ].
This example uses the NameValue constructor to build a mapshape vector and define two dynamic features.
Construct a mapshape Vector Specifying Several NameValue Pairs
The mapshape vector can be indexed like any MATLAB vector. You can access any element of the vector to obtain a specific feature. The following example demonstrates this behavior.
Construct a mapshape vector Containing Multiple Features and Indexing Behaviors
This example builds a mapshape vector from a structure array; adds a Metadata property and demonstrates selective indexing behavior.
The following example shows a variety of indexing behaviors.
If either X
or Y
is
set to [ ], then both coordinate properties are set to [ ] and all
dynamic Vertex or Feature properties are removed.
If a Vertex or Feature property is set to [ ], then it is removed from the object.