Any idea why all([]) is true while any([]) is false
Ältere Kommentare anzeigen
>> all([])
ans =
1
>> any([])
ans =
0
1 Kommentar
Ryan
am 29 Jul. 2012
It's written into the documentation as such, but no explanation is given.
Akzeptierte Antwort
Weitere Antworten (1)
the cyclist
am 29 Jul. 2012
I can't say I know definitively, but I expect that one reason is for consistency when taking the union of sets with the empty set. For example, one would want
all(union(true,[]))
to be true, and also
any(union(false,[]))
to be false. The definitions in your question make sense in that context.
Kategorien
Mehr zu File Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!