Resize a matrix or vector:REDIM, redim

### 5.49.17 Resize a matrix or vector:REDIM, redim

The REDIM (or redim) command takes two arguments. They are either a matrix and a list of two integers, or a vector and an integer.
REDIM returns the matrix or vector resized according to the second argument; removing elements to make it shorter, if necessary, or adding 0s to make it larger.
Input:

REDIM([[4,1,-2],[1,2,-1],[2,1,0]],[5,4])

Output:

[[4,1,-2,0],[1,2,-1,0],[2,1,0,0],[0,0,0,0],[0,0,0,0]]

Input:

REDIM([[4,1,-2],[1,2,-1],[2,1,0]],[2,1])

Output:

[[4],[1]]

Input:

REDIM([4,1,-2,1,2,-1],10)

Output:

[4,1,-2,1,2,-1,0,0,0,0]

Input:

REDIM([4,1,-2,1,2,-1],3)

Output:

[4,1,-2]