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

 採用された回答

Wan Ji
Wan Ji 2021 年 9 月 4 日
編集済み: Wan Ji 2021 年 9 月 4 日
Use isempty
x = [];
isempty(x)
Then the answer is
ans =
logical
1

1 件のコメント

Wan Ji
Wan Ji 2021 年 9 月 4 日
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.

サインインしてコメントする。

その他の回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 9 月 4 日
x=[];
[R,C]=size(x)
if R==0 & C==0
disp('Empty')
else
disp('Contains STH')
end

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by