resizem
(Removed) Resize regular data grid
resizem
has been removed. Use the georesize
or
imresize
function instead. For more information, see Version History.
Syntax
Description
resizes Zscaled
= resizem(Z
,[numrows numcols]
)Z
to have numrows
rows and
numcols
columns.
[___] = resizem(___,
specifies alternate interpolation methods.method
)
[___] = resizem(___,
applies 2-D FIR filter h
)h
to the data grid before resizing, for
all interpolation methods.
Examples
Resize Regular Data Grid
Define a sample data grid.
Z = [1 2; 3 4]
Z = 2×2
1 2
3 4
Double the size of the grid using nearest neighbor interpolation.
neargrid = resizem(Z,2)
neargrid = 4×4
1 1 2 2
1 1 2 2
3 3 4 4
3 3 4 4
Double the size of the grid using bilinear interpolation.
bilingrid = resizem(Z,2,'bilinear')
bilingrid = 4×4
1.0000 1.3333 1.6667 2.0000
1.6667 2.0000 2.3333 2.6667
2.3333 2.6667 3.0000 3.3333
3.0000 3.3333 3.6667 4.0000
Resize the grid to have three rows and two columns using bicubic interpolation.
bicubgrid = resizem(bilingrid,[3 2],'bicubic')
bicubgrid = 3×2
0.7406 1.2994
1.6616 2.3462
1.9718 2.5306
Input Arguments
Z
— Regular data grid
M-by-N numeric array
Regular data grid, specified as an
M-by-N numeric array that may
contain NaN
values. Z
is either a
georeferenced data grid, or a regular data grid associated with a geographic
reference R
.
scale
— Resizing scale factor
positive scalar
[numrows numcols]
— Output grid size
1-by-2 vector of positive integers
Output grid size, specified as a 1-by-2 vector of positive integers.
R
— Geographic reference
geographic raster reference object | vector | matrix
Geographic reference, specified as one of the following. For more information about referencing vectors and matrices, see Georeferenced Raster Data.
Type | Description |
---|---|
Geographic raster reference object |
|
Vector | 1-by-3 numeric vector with elements: [cells/degree northern_latitude_limit western_longitude_limit] Note When |
Matrix | 3-by-2 numeric matrix that transforms raster row and column indices to or from geographic coordinates according to: [lon lat] = [row col 1] * R
|
method
— Interpolation method
'nearest'
(default) | 'bilinear'
| 'bicubic'
Interpolation method, specified as one of the following.
Method | Description |
---|---|
'nearest' | Nearest neighbor interpolation |
'bilinear' | Bilinear interpolation |
'bicubic' | Bicubic interpolation |
Note
If the grid size is being reduced (that is, when
scale
is less than 1 or [numrows
numcols]
is less than the size of the input grid) and
method
is 'bilinear'
or
'bicubic'
, then resizem
applies a low-pass filter before interpolation to reduce aliasing. The
default filter size is 11-by-11. You can specify a different length for
the default filter using the n
argument. You can
specify a nondefault filter using the h
argument.
Data Types: char
| string
n
— Low-pass filter size
11
(default) | nonnegative integer
Low-pass filter size, specified as a nonnegative integer. The filter size
is n
-by-n
. If
n
is 0
, or if
method
is 'nearest'
, then
resizem
does not perform low-pass filtering.
h
— 2-D FIR filter
numeric matrix
Output Arguments
Zscaled
— Rescaled data grid
numeric array
Rescaled data grid, returned as a numeric array.
Rscaled
— Rescaled geographic reference
geographic raster reference object | vector | matrix
Rescaled geographic reference, returned as a geographic raster reference
object, numeric vector, or numeric matrix, consistent with the format of
R
.
Version History
Introduced before R2006aR2023b: Removed
Some functions that accept referencing vectors or referencing matrices as input
have been removed, including the resizem
function. Use a
geographic reference object and the georesize
function instead. If your data is not geographically
referenced, then use the imresize
function instead. Reference objects have several advantages
over referencing vectors and matrices.
Unlike referencing vectors and 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 more information about reference object properties, see the
GeographicCellsReference
andGeographicPostingsReference
objects.You can manipulate the limits of geographic rasters associated with reference objects using the
geocrop
function.You can manipulate the size and resolution of geographic rasters associated with reference objects using the
georesize
function.
To update your code, first create a reference object for either a raster of cells
using the georefcells
function or a raster of
regularly posted samples using the georefpostings
function. Alternatively, convert from a referencing
vector or referencing matrix to a reference object using the refvecToGeoRasterReference
or refmatToGeoRasterReference
function, respectively.
Then, replace uses of the resizem
function with the
georesize
function. This table shows typical uses of the
resizem
function and how to update your code to use the
georesize
function instead. Note that the default method of
interpolation for the georesize
function is
'cubic'
instead of
'nearest'
.
Removed | Recommended |
---|---|
[B,RB] = resizem(A,scale,R); |
[B,RB] = georesize(A,R,scale,'nearest'); |
[B,RB] = resizem(A,[numrows numcols],R); |
latscale = numrows / R.RasterSize(1);
lonscale = numcols / R.RasterSize(2);
[B,RB] = georesize(A,R,latscale,lonscale,'nearest'); |
[B,RB] = resizem(A,scale,R,method); |
[B,RB] = georesize(A,R,scale,method); |
[B,RB] = resizem(A,[numrows numcols],R,method); |
latscale = numrows / R.RasterSize(1); lonscale = numcols / R.RasterSize(2); [B,RB] = georesize(A,R,latscale,lonscale,method); |
If your data is not geographically referenced, then use the
imresize
function instead. This table shows typical uses of
the resizem
function without reference object information and
how to update your code to use the imresize
function
instead.
Removed | Recommended |
---|---|
B = resizem(A,scale,R); |
B = imresize(A,scale); |
B = resizem(A,[numrows numcols],R); |
B = imresize(A,[numrows numcols]); |
B = resizem(A,scale,R,method); |
B = imresize(A,scale,method); |
B = resizem(A,[numrows numcols],R,method); |
B = imresize(A,[numrows numcols],method); |
R2022a: Warns
The resizem
function issues a warning that it will be removed
in a future release.
R2020b: To be removed
The resizem
function runs without warning but will be removed
in a future release.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)