Opening the book…
MATLAB also includes functions that test the type or properties of an array. These functions return logical values: true or false.
|
Function |
Purpose |
|
ischar(A) |
Tests whether A is a character array |
|
islogical(A) |
Tests whether A is a logical array |
|
isnumeric(A) |
Tests whether A is numeric |
|
isinteger(A) |
Tests whether A is an integer array |
|
isfloat(A) |
Tests whether A is a floating-point array |
|
isreal(A) |
Tests whether A contains real values |
|
isa(A, className) |
Tests whether A belongs to a specific class |
|
isprime(A) |
Returns true for prime values in A |
|
isfinite(A) |
Returns true for finite values in A |
|
isinf(A) |
Returns true for infinite values in A |
|
isnan(A) |
Returns true for NaN values in A |
|
isequal(A,B) |
Tests whether arrays have the same contents |
These functions are useful for checking data before performing calculations. For example, you may want to confirm that an input is numeric before trying to calculate with it.
This page titled 4.14: Logical Functions for Arrays was last modified on Tue, 30 Jun 2026 02:11:58 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.