How to check if an array is empty without using any built in functions
95 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sai krishna vollala
am 4 Sep. 2021
Kommentiert: Wan Ji
am 4 Sep. 2021
x = [];
x == [] , gives 0×0 empty logical array...
0 Kommentare
Akzeptierte Antwort
Wan Ji
am 4 Sep. 2021
Bearbeitet: Wan Ji
am 4 Sep. 2021
Use isempty
x = [];
isempty(x)
Then the answer is
ans =
logical
1
1 Kommentar
Wan Ji
am 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.
Weitere Antworten (1)
Sulaymon Eshkabilov
am 4 Sep. 2021
x=[];
[R,C]=size(x)
if R==0 & C==0
disp('Empty')
else
disp('Contains STH')
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!