Dim

From VLECK
Jump to: navigation, search


Returns the lengths of all dimension of a matrix or structure

Syntax

Result = Dim(Values);

Return Value

Dim returns the dimensions of a matrix or structure. The return value is a matrix or structure with the same number of layers as the argument Values , but with the shape of each matrix reduced to a one-dimensional matrix. The length of the return matrix equals the number of dimensions of the argument, with each element equal to the length of the corresponding dimension.

Parameters

Values structure or matrix with text or numerical values


Example


A=Redim(1#5;10)

A=Redim(1#5;10):

1 2 3 4 5 1 2 3 4 5

R = dim(A)

R = dim(A)

10

Example


A=Redim(1#30; 2,3,5)

A=Redim(1#30; 2,3,5)

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15



16 17 18 19 20

21 22 23 24 25

26 27 28 29 30

R = dim(A)

R = dim(A)

2 3 5

B = {A;A[1;;4]}

B = {A;A[1;;4]}

[1] : A [2] : A

R = dim(B)

R = dim(B)

[1] [2]

R[1]

R[1]

2 3 5

R[2]

R[2]

1 3 1