isempty

Return true if variable var is an empty matrix.

Syntax

  • res = isempty(var)

Input argument

  • var - a variable

Output argument

  • res - a logical: true or false

Description

isempty returns a logical true if the argument is an empty matrix.

Any one of its dimensions is zero.

Examples

A = rand(3, 3, 3);
res = isempty(A)
A(:, :, :) = [];
res = isempty(A)
B = {};
res = isempty(B)
C = struct()
res = isempty(C)
C = struct([])
res = isempty(C)

See also

class, isstruct.

History

Version
Description

1.0.0

initial version

Author

Allan CORNET

Last updated