Main Content

isprop

Determine if property exists in geographic or planar vector

Description

tf = isprop(v,name) determines whether the value specified by name is a property in geographic or planar vector v.

example

tf = isprop(v,names) determines whether each value specified by names is a property in v.

example

Examples

collapse all

Create a geoshape vector.

s = geoshape(-33.961, 18.484, 'Name', 'Cape Town');

Check if Latitude and Name are properties in the geoshape vector.

isprop(s, 'Latitude')
ans = logical
   1

isprop(s, 'Name')
ans = logical
   1

Both Latitude and Name are properties in the geoshape vector.

Create a mappoint vector.

mp = mappoint(-33.961, 18.484, 'Name', 'Cape Town')
mp = 
 1x1 mappoint vector with properties:

 Collection properties:
    Geometry: 'point'
    Metadata: [1x1 struct]
 Feature properties:
           X: -33.9610
           Y: 18.4840
        Name: 'Cape Town'

Check if a group of properties exist in the mappoint vector.

tf = isprop(mp, {'X','x','Latitude','Name'})
tf = 1x4 logical array

   1   0   0   1

The first and last elements of tf are 1 (true) because the properties X and Name exist in the mappoint vector. The second and third elements of tf are 0 (false) because the properties x and Latitude do not exist in the mappoint vector. Property names are case-sensitive.

Input Arguments

collapse all

Geographic or planar vector, specified as a geopoint, geoshape, mappoint, or mapshape object.

Name of a single property, specified as a character vector.

Name of multiple properties, specified as a cell array of character vectors.

Output Arguments

collapse all

Flag indicating the property exists in the geographic or planar vector, returned as a logical scalar or vector. Each element of tf is True when the corresponding value in name or names is a property that exists in v.

Data Types: logical

Version History

Introduced in R2012a