Contradictions in ANY and ALL?
Show older comments
Can someone please explain why MATLAB produces
any([]) = 0,
but we get
all([]) = 1 ?
This seems like a contradiction. The answer ought to be 1 for both.
Accepted Answer
More Answers (1)
James Tursa
on 8 Jul 2015
Edited: James Tursa
on 8 Jul 2015
0 votes
Only TMW can explain their reasoning, but this behavior is specifically documented for both functions. What doesn't seem to be documented is the behavior for other sized empty matrices/arrays.
Categories
Find more on Functions 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!