isfield
Determine if dynamic property exists in geographic or planar vector
Description
Examples
Check If a Dynamic Property Exists in a Mappoint 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 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.
Check If Multiple Dynamic Properties Exist in a Geoshape 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
name
— Name of single property
character vector
Name of a single property, specified as a character vector.
names
— Name of multiple properties
cell array of character vectors
Name of multiple properties, specified as a cell array of character vectors.
Output Arguments
tf
— Flag indicating the dynamic property exists in the geographic or planar vector
logical scalar or vector
Version History
Introduced in R2012a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)