Main Content

# sizem

(Removed) Row and column dimensions needed for regular data grid

sizem has been removed. Instead, create a geographic raster reference object, and then query its RasterSize property. For more information, see Version History.

## Syntax

[r,c] = sizem(latlim,lonlim,scale)
rc = sizem(latlim,lonlim,scale)
[r,c,refvec] = sizem(latlim,lonlim,scale)

## Description

[r,c] = sizem(latlim,lonlim,scale) returns the required size for a regular data grid lying between the latitude and longitude limits specified by the two-element input vectors latlim and lonlim, which are of the form [south-limit north-limit] and [west-limit and east-limit], respectively. The scale is the desired cells-per-degree measure of the desired data grid.

rc = sizem(latlim,lonlim,scale) returns the size of the matrix in one two-element vector.

[r,c,refvec] = sizem(latlim,lonlim,scale) also returns the three-element referencing vector geolocating the desired regular data grid.

## Examples

How large a matrix would be required for a map of the world at a scale of 25 matrix cells per degree? (That's 25x25=625 cells per “square” degree.)

[r,c] = sizem([90,-90],[-180,180],25)

r =
4500
c =
9000

Bear in mind for memory purposes — 9000 x 4500 = 4.05 x 107 entries!

## Version History

Introduced before R2006a

expand all

### R2023b: Removed

Some functions that return referencing vectors have been removed, including the sizem function. Instead, create a geographic raster reference object using the georefcells function, and then query its RasterSize property. Reference objects have several advantages over referencing vectors.

• Unlike referencing vectors, reference objects have properties that document the size of the associated raster, its geographic limits, and the direction of its rows and columns. For examples of reference object properties, see the GeographicPostingsReference object.

• You can manipulate the limits of rasters associated with geographic reference objects using the geocrop function.

• You can manipulate the size and resolution of rasters associated with geographic reference objects using the georesize function.

• Most functions that accept referencing vectors as inputs also accept reference objects.

This table shows how to update your code to use the georefcells function instead of the sizem function.

RemovedRecommended
[nrows,ncols] = sizem(latlim,lonlim,scale);
R = georefcells(latlim,lonlim,1/scale,1/scale);
nrows = R.RasterSize(1);
ncols = R.RasterSize(2);