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.


Return size of geographic or planar vector


sz = size(v)
sz = size(v,dim)
[m, n] = size(v)



sz = size(v) returns the vector [length(v), 1].

sz = size(v,dim) returns the length of geographic or planar vector v in the dimension specified by dim.

[m, n] = size(v) returns the length of v for m and 1 for n.


collapse all

Create a mapshape vector from a structArray.

structArray = shaperead('worldrivers');
ms = mapshape(structArray)
ms = 
 128x1 mapshape vector with properties:

 Collection properties:
    Geometry: 'line'
    Metadata: [1x1 struct]
 Vertex properties:
  (128 features concatenated with 127 delimiters)
           X: [1x5542 double]
           Y: [1x5542 double]
 Feature properties:
        Name: {1x128 cell}

Get the size of the mapshape vector.

sz = size(ms)
sz = 

   128     1

Input Arguments

collapse all

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

Dimension to measure length of vector v, specified as a positive integer scalar.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Output Arguments

collapse all

Size of vector v, returned as a nonnegative integer scalar or a two-element vector.

  • When dim is not specified, sz is the two-element vector [length(v), 1].

  • When dim is 1, sz is a scalar equal to the length of v.

  • When dim ≥ 2, sz is 1.

Data Types: double

Size of vector v in the first dimension, returned as a nonnegative integer scalar. m is length(v).

Data Types: double

Size of vector v in the second dimension, returned as the value 1.

Data Types: double

See Also

Introduced in R2012a

Was this topic helpful?