Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Planar shape vector

A mapshape vector is an object that represents planar vector
features with either point, line, or polygon topology. The features
consist of * x*- and

`.`

) notation.

constructs
an empty mapshape vector, `s`

= mapshape()`s`

, with these default
property settings.

s = 0x1 mapshape vector with properties: Collection properties: Geometry: 'line' Metadata: [1x1 struct] Vertex properties: X: [] Y: []

`s`

is always a column vector. 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`

.
For an example, see Construct a Mapshape Vector Specifying X and Y Values.

constructs
a mapshape vector, then adds dynamic properties to the mapshape vector
using `s`

= mapshape(`x`

,`y`

,`Name,Value`

,)`Name`

, `Value`

argument
pairs. You can specify several name-value pair arguments in any order
as `Name1,Value1,...,NameN,ValueN`

. For an example,
see Construct a Mapshape Vector with Dynamic Properties.

constructs
a `s`

= mapshape(`structArray`

)`mapshape`

vector, assigning the fields of the
structure array, `structArray`

, as dynamic properties.
Field values in `structArray`

that are not numeric,
logical, character vectors, cell arrays of character vectors, or cell
arrays of numeric, logical, or cell array of character vectors 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, sets the `X`

and `Y`

properties
equal to the numeric vectors `x`

and `y`

,
and sets dynamic properties from the field values of `structArray`

.
For an example, see Construct a Mapshape Vector Using Cell Arrays and Structures
to Define Multiple Features and Properties.

Construct a mapshape vector with dynamic properties using comma-separated
pairs of `Name,Value`

arguments. `Name`

is
the name of the dynamic property and `Value`

is the
corresponding value. `Name`

must appear inside single
quotes (`' '`

). You can specify
several dynamic properties as `Name1,Value1,...,NameN,ValueN`

.

If `Value`

is specified as a numeric, logical,
character vector, or cell array of character vectors, then the property
is designated a Feature property. If `Value`

is specified
as a cell array of numeric, logical, or cell array of character vectors,
then the property is designated a Vertex property. If `Value`

is
any other type, then the field is ignored and no dynamic property `Name`

is
added to the mapshape vector.

append | Append features to mapshape vector |

cat | Concatenate mapshape vectors |

disp | Display mapshape vector |

fieldnames | Return dynamic property names of mapshape vector |

isempty | Return true if mapshape vector is empty |

isfield | Return true if dynamic property exists |

isprop | Return true if property exists |

length | Return number of elements in mapshape vector |

properties | Return property names of mapshape vector |

rmfield | Remove dynamic property from mapshape vector |

rmprop | Remove properties from mapshape vector |

size | Return size of mapshape vector |

struct | Convert mapshape vector to scalar structure |

vertcat | Vertically concatenate mapshape vectors |

Value. To learn how value classes affect
copy operations, see Copying Objects (MATLAB) in
the MATLAB^{®} documentation.

If

`X`

,`Y`

, or a dynamic property is set with more values than features in the mapshape vector, then all other properties expand in size using 0 for numeric values and an empty character vector (`''`

) for cell values.If a dynamic property is set with fewer values than the number of features, then this dynamic property expands to match the size of the other properties.

If the

`X`

or`Y`

property of the mapshape vector is set with fewer values than contained in the object, then all other properties shrink in size.If either

`X`

or`Y`

is set to [ ], then both coordinate properties are set to [ ] and all dynamic properties are removed.If a dynamic property is set to [ ], then it is removed from the object.

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. Construct a Mapshape Vector and Add Metadata and Indexing

Was this topic helpful?