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 point vector

`p = mappoint()`

p = mappoint(x,y)

p = mappoint(x,y,Name,Value)

p = mappoint(structArray)

p = mappoint(x,y,structArray)

A mappoint vector is a container object that holds planar point coordinates and attributes. The points are coupled, such that the size of the X and Y coordinate arrays are always equal and match the size of any dynamically added attribute arrays. Each entry of a coordinate pair and associated attributes, if any, represent a discrete element in the mappoint vector.

constructs
an empty mappoint vector, `p`

= mappoint()`p`

, with these default
property settings:

p = 0x1 mappoint vector with properties: Collection properties: Geometry: 'point' Metadata: [1x1 struct] Feature properties: X: [] Y: []

constructs
a new mappoint vector and assigns the `p`

= mappoint(`x`

,`y`

)`X`

and `Y`

properties
to the numeric array inputs, `lat`

and `lon`

.
For an example, see Construct a mappoint Vector from x and y Values.

constructs
a mappoint vector from input arrays `p`

= mappoint(`x`

,`y`

,`Name,Value`

)`x`

and `y`

,
and then adds dynamic properties to the mappoint vector using the `Name`

, `Value`

argument
pairs.

If a specified name is

`Metadata`

and the corresponding`Value`

is a scalar structure, then the value is copied to the`Metadata`

property. Otherwise, an error is issued.

For an example, see Construct a mappoint Vector from x, y, and Temperature Values.

constructs
a new `p`

= mappoint(`structArray`

)`mappoint`

vector from the fields of the structure, `structArray`

.
See for an example.

If

`structArray`

is a scalar structure containing the field`Metadata`

and the field value is a scalar structure, then the`Metadata`

field is copied to the`Metadata`

property. Otherwise, an error is issued if the`Metadata`

field is not a structure, or ignored if`structArray`

is not scalar.Other fields of

`structArray`

are assigned to`p`

and become dynamic properties. Field values in`structArray`

that are not numeric values, character vectors, or cell arrays of numeric values or character vectors are ignored.

For an example, see Construct a mappoint Vector from a Structure Array.

constructs
a new `p`

= mappoint(`x`

,`y`

,`structArray`

)`mappoint`

vector and sets the `X`

and `Y`

properties
equal to the numeric arrays, `x`

and `y`

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

.

If

`structArray`

is a scalar structure containing the field`Metadata`

, and the field value is a scalar structure, then it is copied to the`Metadata`

property. 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 mappoint Vector from x and y Numeric Arrays and a Structure Array.

append | Append features to mappoint vector |

cat | Concatenate mappoint vectors |

disp | Display mappoint vector |

fieldnames | Dynamic properties of mappoint vector |

isempty | True if `mappoint` vector is empty |

isfield | Returns true if dynamic property exists |

isprop | Returns true if property exists |

length | Number of elements in mappoint vector |

properties | properties of a mappoint vector |

rmfield | Remove dynamic property from mappoint vector |

rmprop | Remove properties from mappoint vector |

size | Size of `mappoint` vector |

struct | Convert mappoint vector to scalar structure |

vertcat | Vertical concatenation for mappoint vectors |

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

This example builds a default mappoint object and then dynamically adds a single feature.

mappoint vectors autoresize all properties lengths to ensure they are equal in size when a new dynamic property is added or an existing property appended or shortened.

Construct a mappoint Vector for Two Features and Add Features Dynamically

The class syntax containing the

`Name-Value`

pair allows features to be included during object construction.The data for the following example resides in a MAT file containing oceanic depths.

This example also accesses data from a file and loads it into a structure array. Features are then added to the mappoint illustrating a number of behaviors.

Assign Dynamic Features to mappoint Vector from a Structure Array

In this example, a feature is added to the mappoint vector using linear indexing.

Features can be sorted by using the indexing behavior of the mappoint class.

This example demonstrates that input arguments

`x`

and`y`

can be either row or column vectors.

Was this topic helpful?