Graphics Reference
In-Depth Information
Here are some examples:
>> A = 2:7;P =(A>3) & (A<6)
P =
0 0 1 1 0 0
Returns 1 when A is greater than 3 and less than 6, and returns 0 otherwise.
>> X = 3 * ones (3.3); X > = [7 8 9; 4 5 6 and 1 2 3]
Ans =
0 0 0
0 0 0
1 1 1
The elements of the array X which are greater or equal to that of the matrix [7 8 9; 4 5 6 and 1 2 3] correspond to a
1 in the matrix response. The rest of the elements correspond to a 0.
A.12.4 Logical Functions
MATLAB implements logical functions whose output is of the true type (value 1) or false (value 0). The following table
shows the most important:
exist (A)
Checks if the variable or function exists (returns 0 if A does not exist and a number between
1 and 5, depending on the type, if it exists)
any (V)
Returns 0 if all elements of the vector V are null and returns 1 if some element of V are non-zero
any(A)
Returns 0 for each column of the matrix A with all null elements and returns 1 for each column
of the matrix A with some of its elements non-null
all (V)
Returns 1 if all the elements of the vector V are non-null and returns 0 if some element of V is null
all(A)
Returns 1 for each column of the matrix A with all the non-null elements and returns 0 for each
column of the matrix A with some of its elements void
find (V)
Returns the places (or indices) that occupy the non-null elements of the vector V
isnan (V)
Returns 1 for the elements of V that are indeterminate and returns 0 for those that are not
isinf (V)
Returns 1 for the elements of V that are infinite and returns 0 for those that are not
isfinite (V)
Returns 1 for the elements of V that are finite and returns 0 for those that are not
Isempty (A)
Returns 1 if A is an empty array and returns 0 otherwise (an empty array has one of its
dimensions 0)
issparse (A)
Returns 1 if A is an array of boxes and returns 0 otherwise
Isreal (V)
It returns 1 if all the elements of V are real and 0 otherwise
isprime (V)
Returns 1 for all elements of V that are prime and returns 0 for elements of V that are not prime
islogical (V)
It returns 1 if V is a logical vector and 0 otherwise
( continued )
 
Search WWH ::




Custom Search