Any idea why all([]) is true while any([]) is false
1 次查看(过去 30 天)
显示 更早的评论
>> all([])
ans =
1
>> any([])
ans =
0
2 个评论
采纳的回答
更多回答(1 个)
the cyclist
2012-7-29
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!