How to check if an array is empty without using any built in functions
57 ビュー (過去 30 日間)
表示 古いコメント
x = [];
x == [] , gives 0×0 empty logical array...
0 件のコメント
採用された回答
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
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
2021 年 9 月 4 日
x=[];
[R,C]=size(x)
if R==0 & C==0
disp('Empty')
else
disp('Contains STH')
end
0 件のコメント
参考
カテゴリ
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!