isfield

Determine if dynamic property exists in geographic or planar vector

Description

example

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

example

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

Examples

collapse all

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 individual properties are dynamic properties in the mappoint vector.

isfield(mp, 'X')
ans = logical
   0

This result is 0 (false) because property X in the mappoint vector is not a dynamic property.

isfield(mp, 'Name')
ans = logical
   1

This result is 1 (true) because the property Name is a dynamic property that exists in the mappoint vector.

isfield(mp,'Latitude')
ans = logical
   0

This result is 0 (false) because the dynamic property Latitude does not exist in the mappoint vector.

Create a geoshape vector.

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

 Collection properties:
     Geometry: 'line'
     Metadata: [1x1 struct]
 Vertex properties:
     Latitude: -33.9610
    Longitude: 18.4840
 Feature properties:
         Name: 'Cape Town'

Check if a group of properties are dynamic properties in the geoshape vector.

tf = isfield(gs, {'Latitude','longitude','Name'})
tf = 1x3 logical array

   0   0   1

The first element of tf is 0 (false) because the property Latitude exists in the geoshape vector but is not a dynamic property. The second element of tf is 0 (false) because the property longitude does not exist in the geoshape vector (property names are case-sensitive.) The last element of tf is 1 (true), indicating that Name is a dynamic property in the geoshape vector.

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 dynamic 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 dynamic property that exists in v.

Data Types: logical

See Also

|

Introduced in R2012a