# Check Whether an Array or Matrix Is Empty or Not in MATLAB

A simple empty matrix is the one with dimensions `0 x 0`. The matrix with dimensions `0 x n` and `n x 0` is also empty.

This tutorial demonstrates how to use `isempty()` to check if an array or matrix is empty.

## Use `isempty()` to Determine Whether an Array or Matrix Is Empty or Not in MATLAB

The `isempty()` method checks if a matrix or array is empty or not. It will return `1` as true if the array is empty and `0` as false if not.

Example:

``````A = [1, 2, 3];
B= [];
C = rand(2,2,2);
D = [1 3 5; 2 4 6; 7 8 10];
D(:,:,:) = []; %% Deleting the members of D matrix

disp('The Result for array A is: '); disp(isempty(A))
disp('The Result for array B is: '); disp(isempty(B))
disp('The Result for Matrix C is: '); disp(isempty(C))
disp('The Result for Matrix D is: '); disp(isempty(D))
``````

Output:

``````The Result for array A is:
0

The Result for array B is:
1

The Result for Matrix C is:
0

The Result for Matrix D is:
1
``````
Write for us
DelftStack articles are written by software geeks like you. If you also would like to contribute to DelftStack by writing paid articles, you can check the write for us page.

## Related Article - MATLAB Array

• Create Array of Zeros in MATLAB
• Find Index of Value in Array in Matlab
• Get Average of Array With the mean() Function in Matlab
• ## Related Article - MATLAB Matrix

• Create Array of Zeros in MATLAB
• Find Index of Value in Array in Matlab
• Get Average of Array With the mean() Function in Matlab