Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

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.

isfield

Class: geoshape

Return true if dynamic property exists

Syntax

tf = isfield(s,name)
tf = isfield(s,names)

Description

tf = isfield(s,name) returns true if the value specified by the character vector name is a dynamic property of the geoshape vector, s.

tf = isfield(s,names) return true for each element of the cell array, names, that is a dynamic property of s. tf is a logical array of the same size as names.

Input Arguments

s

geoshape vector.

name

Name of the dynamic property.

names

Cell array of names of dynamic properties.

Output Arguments

tf

Boolean. 1 if s contains the specified fields or 0 otherwise.

Examples

expand all

Create a geoshape vector and check if a field is present.

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

 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'


ans =

     0


ans =

     1

Note that Latitude returns 0 because it is not a dynamically added property.

Was this topic helpful?