Main Content


(Removed) Construct sparse regular data grid of 0s

spzerom has been removed. Use the georefcells and sparse functions instead. For more information, see Compatibility Considerations.


[Z,refvec] = spzerom(latlim,lonlim,scale)


[Z,refvec] = spzerom(latlim,lonlim,scale) returns a sparse regular data grid consisting entirely of 0s and a three-element referencing vector for the returned Z. The two-element vectors latlim and lonlim define the latitude and longitude limits of the geographic region. They should be of the form [south north] and [west east], respectively. The scalar scale specifies the number of rows and columns per degree of latitude and longitude.


[Z,refvec] = spzerom([46,51],[-79,-75],1)

Z =
   All zero sparse: 5-by-4
refvec =
     1    51   -79

Version History

Introduced before R2006a

expand all

R2023b: Removed

Some functions that return referencing vectors have been removed, including the spzerom function. Instead, create a geographic raster reference object using the georefcells function and a sparse matrix of all zeros using the sparse function. 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 and sparse functions instead of the spzerom function.

[Z,refvec] = spzerom(latlim,lonlim,scale);
R = georefcells(latlim,lonlim,1/scale,1/scale);
Z = sparse(R.RasterSize(1),R.RasterSize(2));

See Also

| | | |