[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Matlab check for negation of empty matrix
From: |
Rik |
Subject: |
Matlab check for negation of empty matrix |
Date: |
Thu, 27 Mar 2014 09:00:14 -0700 |
3/27/14
Could someone run the following code under Matlab?
x = [];
if (~x)
disp ('branch 1');
else
disp ('branch 2');
end
There have been two issues with this construct in the last two days.
Coming from a scripting background like Perl or Python, I would expect []
to evaluate as false and '~' to negate this to true. But, it seems that
~[] is still [] which means isempty should really always be used instead of
the negation operator.
--Rik
- Matlab check for negation of empty matrix,
Rik <=