isempty is allways zero

1 次查看(过去 30 天)
Hello,
im using isempty:
TP =
0 0 0
>> isempty(TP)
ans =
logical
0
>> TP(3) = 1
TP =
0 0 1
>> isempty(TP)
ans =
logical
0
Why is locical answer still zero? What can I do? I need to check multiple arrays for empty or not in if-else blocks.

采纳的回答

Fangjun Jiang
Fangjun Jiang 2020-5-27
zero and empty are different
isempty([])
isempty(0)
isempty('')
  4 个评论
Nik Rocky
Nik Rocky 2020-5-27
TP1 =
0 0 0
>> TP2 = [0 1 0]
TP2 =
0 1 0
>> any(TP1)
ans =
logical
0
>> any(TP2)
ans =
logical
1
Right?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Argument Definitions 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by