Main Content

ismultipoint

Determine which array elements are multipoint shapes

Since R2022b

    Description

    example

    tf = ismultipoint(shape) returns a logical array whose elements are 1 (true) when the corresponding shape object in shape is a multipoint shape. A shape object is a multipoint shape when it is a geopointshape or mappointshape object and the value of its NumPoints property is greater than 1.

    Examples

    collapse all

    Create an array of point shapes.

    shape = geopointshape({39,[38 -30 29]},{-113,[-66 -31 42]});

    Determine which elements of the array are multipoint shapes. The result indicates that the second element is a multipoint shape.

    tf = ismultipoint(shape)
    tf = 1x2 logical array
    
       0   1
    
    

    Accessing the coordinate properties of a point shape array is not supported when the array contains multipoint shapes. You can determine whether an array contains multipoints by using the ismultipoint and any functions.

    Create an array of geopointshape objects that represent locations in Boston, and determine which are multipoint shapes.

    GT = readgeotable("boston_placenames.gpx");
    shape = GT.Shape;
    tf1 = ismultipoint(shape);

    Use the any function to check whether the ismultipoint function detected any multipoint shapes in the array. A value of 0 indicates that the array does not contain multipoint shapes.

    any(tf1,"all")
    ans = logical
       0
    
    

    Create a multipoint shape that represents three locations. Add the multipoint shape to the end of the array.

    mp = geopointshape({[42.3625 42.3693 42.3477]},{[-71.0904 -71.0733 -71.0787]});
    shape(end+1) = mp;

    Verify that the array contains a multipoint shape.

    tf2 = ismultipoint(shape);
    any(tf2,"all")
    ans = logical
       1
    
    

    Input Arguments

    collapse all

    Shape objects, specified as one of these options:

    Output Arguments

    collapse all

    Indicator for multipoint shape, returned as a logical array. The size of tf matches the size of shape.

    • A logical 1 (true) indicates that the corresponding shape object is a multipoint shape.

    • A logical 0 (false) indicates that the corresponding shape object is not a multipoint shape.

    You can identify points of interest by using tf to index into shape.

    Points of InterestExample Code
    Query multipoint shapesshape(tf)
    Query shapes that are not multipoint shapesshape(~tf)

    Version History

    Introduced in R2022b

    See Also

    Functions

    Objects