isempty#

Purpose#

Returns a 1 if its input is an empty matrix, otherwise returns a 0.

Format#

ret = isempty(x)#
Parameters:

x (matrix) – data

Returns:

ret (scalar) – 1 if x is an empty matrix, otherwise 0.

Examples#

Example 1#

// Create an empty matrix
x = {};

ret = isempty(x);

After the above code, ret will equal 1.

Example 2#

// Create a non-empty matrix
y = 1;

ret = isempty(y);

After the above code, ret will equal 0.

Example 3#

// Create an empty matrix
x = {};

// Check to see if 'x' is an empty matrix
if isempty(x);
    print "x is an empty matrix";
else;
    print "x is not empty";
endif;

The above code will print:

x is an empty matrix

See also

Functions ismiss(), isinfnanmiss()