How to check if an array is empty without using any built in functions

7 views (last 30 days)
x = [];
x == [] , gives 0×0 empty logical array...

Accepted Answer

Wan Ji
Wan Ji on 4 Sep 2021
Edited: Wan Ji on 4 Sep 2021
Use isempty
x = [];
Then the answer is
ans =
  1 Comment
Wan Ji
Wan Ji on 4 Sep 2021
Hi friend,
What do you mean by saying without using any built in functions?
Even x==[], the operator == is a built-in function.
So isempty(x), isqual(x,[]), or even numel(x)==0, length(x)==0
all the above can respond to your question.

Sign in to comment.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 4 Sep 2021
if R==0 & C==0
disp('Contains STH')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by