isempty
Test whether the input has zero elements.
Syntax
Section titled “Syntax”tf = isempty(A)Description
Section titled “Description”Returns logical true when A contains no elements (an empty matrix [], an empty string '', or any other zero-size value), and false otherwise.
In the default script mode, isempty is applied elementwise for non-scalar inputs — useful for checking emptiness of every cell in a cell array. In Excel-compatible mode (cell formulas), the result is always a single scalar.
Examples
Section titled “Examples”isempty([]) % 1isempty('') % 1isempty([1 2 3]) % 0isempty(zeros(0,5)) % 1