Main Content

refvec2mat

(Removed) Convert referencing vector to referencing matrix

refvec2mat has been removed. Instead, convert referencing vectors to geographic raster reference objects using the refvecToGeoRasterReference function. For more information, see Version History.

Syntax

R = refvec2mat(refvec,s)

Description

R = refvec2mat(refvec,s) converts a referencing vector, refvec, to the referencing matrix R. refvec is a 1-by-3 referencing vector having elements [cells/degree north-latitude west-longitude] with latitude and longitude limits specified in degrees. s is the size of the array (data grid) that is being referenced. R is a 3-by-2 referencing matrix defining a two-dimensional affine transformation from pixel coordinates to spatial coordinates.

Examples

% Create a sample data set and referencing vector
N = rand(180,360);
refvec = [1 90 0];
% Convert the referencing vector to a referencing matrix
R = refvec2mat(refvec,size(N));

Version History

Introduced before R2006a

expand all

R2023b: Removed

Some functions that return referencing matrices have been removed, including the refvec2mat function. Instead, convert referencing vectors to geographic raster reference objects using the refvecToGeoRasterReference function. Reference objects have several advantages over referencing matrices.

  • Unlike referencing matrices, 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 matrices as inputs also accept reference objects.

To update your code, replace instances of the refvec2mat function with the refvecToGeoRasterReference function.

R = refvecToGeoRasterReference(refvec,rasterSize);