Main Content

rmfield

Remove dynamic property from geographic or planar vector

Description

example

vout = rmfield(vin,name) removes the dynamic property specified by name from the geographic or planar vector vin.

example

vout = rmfield(vin,names) removes all dynamic properties specified by names from vin.

Note

rmfield cannot remove Metadata, and Geometry properties from any geographic or planar vector. Further, it cannot remove Latitude and Longitude properties from geopoint and geoshape objects, nor X and Y properties from mappoint and mapshape objects.

Examples

collapse all

Create a geopoint vector with dynamic properties.

gp = geopoint([42 42.2],[-110.5 -110.7],'Temperature',[65.6 63.2],'Humidity',[44 41])
gp = 
 2x1 geopoint vector with properties:

 Collection properties:
       Geometry: 'point'
       Metadata: [1x1 struct]
 Feature properties:
       Latitude: [42 42.2000]
      Longitude: [-110.5000 -110.7000]
    Temperature: [65.6000 63.2000]
       Humidity: [44 41]

Remove only the Humidity property from the geopoint vector.

gp2 = rmfield(gp,'Humidity')
gp2 = 
 2x1 geopoint vector with properties:

 Collection properties:
       Geometry: 'point'
       Metadata: [1x1 struct]
 Feature properties:
       Latitude: [42 42.2000]
      Longitude: [-110.5000 -110.7000]
    Temperature: [65.6000 63.2000]

Create a mapshape vector.

ms = mapshape(shaperead('tsunamis.shp'))
ms = 
 162x1 mapshape vector with properties:

 Collection properties:
       Geometry: 'point'
       Metadata: [1x1 struct]
 Vertex properties:
  (162 features concatenated with 161 delimiters)
              X: [128.3000 NaN -156 NaN 157.9500 NaN 143.8500 NaN -155 NaN ... ]
              Y: [-3.8000 NaN 19.5000 NaN -9.0200 NaN 42.1500 NaN 19.1000 NaN ... ]
 Feature properties:
           Year: [1950 1951 1951 1952 1952 1952 1952 1953 1953 1953 1953 1954 ... ]
          Month: [10 8 12 3 3 5 11 3 6 9 11 6 10 4 11 3 6 7 1 4 7 11 11 5 8 8 ... ]
            Day: [8 21 22 4 17 6 4 18 27 14 25 26 NaN 19 2 9 22 28 19 22 10 6 12 ... ]
           Hour: [3 10 NaN 1 3 NaN 16 NaN NaN 0 17 NaN NaN 20 NaN 14 23 8 14 ... ]
         Minute: [23 57 NaN 22 58 NaN 58 NaN NaN 26 48 NaN NaN 24 NaN 22 50 ... ]
         Second: [NaN NaN NaN 41 NaN NaN NaN NaN NaN 36 NaN NaN NaN NaN NaN ... ]
       Val_Code: [2 4 2 4 4 1 4 3 3 4 4 1 2 4 3 4 3 4 4 2 4 4 2 4 4 4 4 4 4 ... ]
       Validity: {1x162 cell}
     Cause_Code: [1 1 6 1 1 9 1 1 6 3 1 9 0 1 1 1 1 1 1 1 3 1 1 1 0 3 1 1 ... ]
          Cause: {1x162 cell}
         Eq_Mag: [7.6000 6.9000 NaN 8.1000 4.5000 NaN 9 5.8000 NaN 6.8000 ... ]
        Country: {1x162 cell}
       Location: {1x162 cell}
     Max_Height: [2.8000 3.6000 6 6.5000 1 1.5200 18 1.5000 1.4000 3 3 3 ... ]
       Iida_Mag: [1.5000 1.8000 2.6000 2.7000 NaN NaN 4.2000 0.6000 0.5000 ... ]
      Intensity: [1.5000 NaN NaN 2 NaN NaN 4 NaN 1 1.5000 1.5000 NaN NaN ... ]
     Num_Deaths: [NaN NaN NaN 33 NaN NaN 2236 NaN NaN NaN NaN 7 NaN 3 NaN ... ]
    Desc_Deaths: [NaN NaN NaN 1 NaN NaN 3 NaN NaN NaN NaN 1 NaN 1 NaN ... ]

Attempt to remove multiple properties from the mapshape vector.

s2 = rmfield(ms,{'Geometry','Second','Minute','intensity'})
s2 = 
 162x1 mapshape vector with properties:

 Collection properties:
       Geometry: 'point'
       Metadata: [1x1 struct]
 Vertex properties:
  (162 features concatenated with 161 delimiters)
              X: [128.3000 NaN -156 NaN 157.9500 NaN 143.8500 NaN -155 NaN ... ]
              Y: [-3.8000 NaN 19.5000 NaN -9.0200 NaN 42.1500 NaN 19.1000 NaN ... ]
 Feature properties:
           Year: [1950 1951 1951 1952 1952 1952 1952 1953 1953 1953 1953 1954 ... ]
          Month: [10 8 12 3 3 5 11 3 6 9 11 6 10 4 11 3 6 7 1 4 7 11 11 5 8 8 ... ]
            Day: [8 21 22 4 17 6 4 18 27 14 25 26 NaN 19 2 9 22 28 19 22 10 6 12 ... ]
           Hour: [3 10 NaN 1 3 NaN 16 NaN NaN 0 17 NaN NaN 20 NaN 14 23 8 14 ... ]
       Val_Code: [2 4 2 4 4 1 4 3 3 4 4 1 2 4 3 4 3 4 4 2 4 4 2 4 4 4 4 4 4 ... ]
       Validity: {1x162 cell}
     Cause_Code: [1 1 6 1 1 9 1 1 6 3 1 9 0 1 1 1 1 1 1 1 3 1 1 1 0 3 1 1 ... ]
          Cause: {1x162 cell}
         Eq_Mag: [7.6000 6.9000 NaN 8.1000 4.5000 NaN 9 5.8000 NaN 6.8000 ... ]
        Country: {1x162 cell}
       Location: {1x162 cell}
     Max_Height: [2.8000 3.6000 6 6.5000 1 1.5200 18 1.5000 1.4000 3 3 3 ... ]
       Iida_Mag: [1.5000 1.8000 2.6000 2.7000 NaN NaN 4.2000 0.6000 0.5000 ... ]
      Intensity: [1.5000 NaN NaN 2 NaN NaN 4 NaN 1 1.5000 1.5000 NaN NaN ... ]
     Num_Deaths: [NaN NaN NaN 33 NaN NaN 2236 NaN NaN NaN NaN 7 NaN 3 NaN ... ]
    Desc_Deaths: [NaN NaN NaN 1 NaN NaN 3 NaN NaN NaN NaN 1 NaN 1 NaN ... ]

The Second and Minute properties have been removed successfully. Note that the Geometry property still exists because it cannot be removed. Also, Intensity has not been removed because property names are case-sensitive.

Input Arguments

collapse all

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

Name of a single property to remove, specified as a character vector. The property in name is case sensitive.

Name of multiple properties to remove, specified as a cell array of character vectors. The properties in names are case-sensitive.

Output Arguments

collapse all

Output geographic or planar vector, returned as a geopoint, geoshape, mappoint, or mapshape object. The object type of vout matches the object type of vin.

Version History

Introduced in R2012a

See Also

| |