2.2.2.16 msresize


Menu Information

Matrix: Resize

Brief Information

Resize all matrices in sheet.

Command Line Usage

1.msresize option:=pad pad:=refl right:=4 top:=3 oms:=[<new>]<new>;

2.msresize interp:=lagrange cols:=64 rows:=32 x1:=1 x2:=10 y1:=1 y2:=10;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Matrix ims

Input

MatrixLayer

<active>

Specifies the input matrix.

Resize Option option

Input

int

2

Specifies the method to resize the Matrix.
Option list:

  • 0=expand:Expand
  • 1=shrink:Shrink
  • 2=interp:Interpolate
  • 3=pad:Pad
Shrink Method shrink

Input

int

2

According to the column factor and row factor, define the shrinked sub-range of the cells in the Matrix. For example, if Col Factor is 2 and Row Factor is 2, four cells (from every two columns and every two rows) will be a sub-range .

This option specifies which value will be output when shrinked.
Option list:

  • 0: KeepFirstCell :
    Keep the first cell in the shrinked sub-range of the cell.
  • 1: KeepLastCell:
    Keep the last cell in the shrinked sub-range of the cell.
  • 2: Average:
    Output the average from the shrinked sub-range of the cell.
  • 3: Sum:
    Output the sum from the shrinked sub-range of the cell.
  • 4:Max
    Output the maximum value fom the shrinked sub-range of the cell.
  • 5: Min
    Output the minimum value from the shrinked sub-range of the cell.
  • 6:SD
    Output the standard deviation from the shrinked sub-range of the cell.
Interpolate Method interp

Input

int

1

Specifies the method to interplate the Matrix.
Option list:

  • 0=nearest:Nearest
    Interpolate using the nearest points.
  • 1=bilinear:Bilinear
    Two dimensional linear interpolation
  • 2=bicubic:Bicubic Convolution
    Two dimensional interpolation using bicubic convolution.
  • 3=spline:Spline
    Two dimensional spline interpolation.
  • 4=biquad:Biquadratic
    Two dimensional quadratic interpolation.
  • 5=lagrange:Bicubic Lagrange
    Two dimensional interpolation using Lagrange polynomials.
Pad Method pad

Input

int

1

Specifies the method to pad the Matrix.


Option list:

  • 0=const:Constant
    Specifies a constant to pad matrix
  • 1=rep:Replicate
    Replicate first left/right column or top/bottom row to pad matrix.
    For example, specifies top pad rows=3, that means inserting three rows in the top of matrix and their value is the same as the first top row of source matrix.
  • 2=sym:Symmetric
    Use the specified number of the left/right columns or top/bottom rows to pad the matrix in a symmetrical manner.
    For example, specifies top pad rows=3, that means inserting three rows in the top of matrix and their value symmetric with the first three rows of the source matrix.
  • 3=cir:Circular
    Use the specified number of the left/right columns or top/bottom rows to pad the matrix in a circular manner.
    For example, specifies top pad rows=3, that means inserting three rows in the top of matrix and their value is the same as the first bottom rows of source matrix.
  • 4=refl:Reflect
    Use the specified number of the left/right columns or top/bottom rows to pad the matrix in a reflect manner.
    For example, specifies top pad rows=3, that means inserting three rows in the top of matrix, and take the first row as the midline reflecting 2 to 4 rows of source matrix.
Col Factor cols

Input

int

2
  • When Resize Option is Expand option=0, specifies a factor to increase the number of columns.

For example, if Col Factor is 2, the number of columns in the output matrix will be twice the number of columns in the input matrix.

  • When Resize Option is Shrink option=1, specifies a factor to reduce the number of columns.

For example, if Col Factor is 2, every two columns in the input matrix will be shrinked into one column.

Row Factor rows

Input

int

2
  • When Resize Option is Expand option=0, specifies a factor to increase the number of rows.

For example, if Row Factor is 2, the number of rows in the output matrix will be twice the number of rows in the input matrix.

  • When Resize Option is Shrink option=1, specifies a factor to reduce the number of rows.

For example, if Row Factor is 2, every two rows in the input matrix will be shrinked into one row.

First X x1

Input

double

<auto>

Specifies the value of the first X coordinate.

Last X x2

Input

double

<auto>

Specifies the value of the last X coordinate.

First Y y1

Input

double

<auto>

Specifies the value of the first Y coordinate.

Last Y y2

Input

double

<auto>

Specifies the value of the last Y coordinate.

Pad Value pval

Input

double

1

When Pad Method is Constant pad=0, specifies a constant as pad value.

Left Pad Columns left

Input

int

0

Specifies the number of left pad columns.

Right Pad Columns right

Input

int

1

Specifies the number of right pad columns.

Top Pad Rows top

Input

int

0

Specifies the number of top pad rows.

Bottom Pad Rows bottom

Input

int

0

Specifies the number of bottom pad rows.

Output Matrix oms

Output

MatrixObject

<input>

Specifies the output matrix.

See the syntax here.

Description

You can use this X-Function to resize a matrix using one of four methods: Expand, Shrink, Interpolate and Pad.

Related X-Functions

mdim, mexpand, mproperty, mreplace, mrotate90, msetvalue, mflip, mtranspose , msmooth


Keywords:resize