randperm
p = randperm(n),返回从1到n的整数,随机排列
p = randperm(n,k),返回从1到n的数中的k个唯一的整数
randperm(6)
might be the vector
[3 2 6 4 1 5]
randperm(6,3)
[4 2 5]
max
returns the largest elements of M
= max(A
)A
.
If
A
is a vector, thenmax(A)
returns the largest element ofA
.If
A
is a matrix, thenmax(A)
is a row vector containing the maximum value of each column.If
A
is a multidimensional array, thenmax(A)
operates along the first array dimension whose size does not equal1
, treating the elements as vectors. The size of this dimension becomes1
while the sizes of all other dimensions remain the same. IfA
is an empty array whose first dimension has zero length, thenmax(A)
returns an empty array with the same size asA
.
returns the largest elements along dimension M
= max(A
,[],dim
)dim
. For example, if A
is a matrix, then max(A,[],2)
is a column vector containing the maximum value of each row.