matlab中的any函数(the function of "any" in matlab)
any True if any element of a vector is a nonzero number or is logical 1 (TRUE). any ignores entries that are NaN (Not a Number).
any函数是用来判断向量中是否含有非零数或者是逻辑1的,但是any函数 会忽略那些不是数字的项。
For vectors, any(V) returns logical 1 (TRUE) if any of the elements of the vector is a nonzero number or is logical 1 (TRUE). Otherwise it returns logical 0 (FALSE). For matrices, any(X) operates on the columns of X, returning a row vector of logical 1's and 0's. For multi-dimensional arrays, any(X) operates on the first non-singleton dimension.
对于向量V来说,any(V)在向量中含有非零元素或者逻辑1时会返回逻辑变量1,否则会返回逻辑0。对于矩阵X来说,any(X)对矩阵X的列进行操作,并返回一个含有逻辑1或者0元素的行向量。对于多位的数组,any(X)则在其第一个维度上进行操作。
any(X,DIM) works down the dimension DIM. For example, any(X,1) works down the first dimension (the rows) of X.
any(X,DIM)则在DIM维(一个表示维度的数字)上进行操作,例如any(X,1)在X的行向量上进行判断。
评论