單詞解析
any[英]adj.任何的;一點,一些;普通的;任何,隨便哪一個
任何;無論哪個;若干
adv.稍微,少許;什麼,一些,一點
1.DET(用於否定句)一點,絲毫,若干,任何You use any in statements with negative meaning to indicate that no thing or person of a particular type exists, is present, or is involved in a situation.
2.DET(用於疑問句或條件從句)若干,一點,什麼,任何一個(或一些)You use any in questions and conditional clauses to ask whether there is some of a particular thing or some of a particular group of people, or to suggest that there might be.
3.DET(用於肯定句)任一的,每一的You use any in positive statements when you are referring to someone or something of a particular kind that might exist, occur, or be involved in a situation, when their exact identity or nature is not important.
4.ADV(用於否定句中強調形容詞或副詞的比較級)任何,絲毫,略微,多少You can also use any to emphasize a comparative adjective or adverb in a negative statement.
5.PHRASE(人或物)很特別的,不普通的If you say that someone or something is not just any person or thing, you mean that they are special in some way.
6.PHRASE(不)再If something does not happen or is not true any more or any longer, it has stopped happening or is no longer true.
7.→see:in any case;→see:case;by any chance→see:chance;in any event→see:event;not by any means→see:means;any old→see:old;at any rate→see:rate;
函式簡介
函式功能:判斷數組中元素是否為0
語法格式:
B = any(A)
判斷數組中元素是否是一個非零元素或邏輯1(true)。any函式會忽略掉數組中的NaN項(not a number)。
如果A是空的,any(A)返回邏輯0(false)。
如果A是一個向量(1行n列或n行1列的矩陣),只要A中有一個非零元素或A中有一個元素是邏輯1,any(A)返回邏輯1(true),否則(A中所有元素均為0)返回邏輯0(false)。
如果A是一個矩陣,any函式把A的每一列當做一個向量,any(A)返回一個行向量。
如果A是一個多維數組,any(A)對A中第一個非奇異維進行判斷。
B = any(A,dim)
dim指定了要進行判定的維數。例如,對於二維數組, any(A, 1)把A中每一列看做一個向量,然後進行判斷;any(A, 2)把A中每一行看做一個向量,然後進行判斷。
相關函式:all
程式示例
>> A = [];
>> any(A)
ans = 0
>> A = [0 1 2 3];
>> any(A)
ans = 1
>> any([0 0 0 0])
ans = 0
>> A = [1 2 3; 4 5 6];
>> any(A)
ans = 1 1 1
>> any(A,2)
ans =
1
1