What does a "~" mean in the following code

A newbie (me) needs to understand a syntax I can't find in the documentation.
if ~isempty(E)
B=[A
E'*S];
end;
What does the ~ (tilde) mean or do prior to the isempty(E)?

2 个评论

Andreas say, "I found it. ~ indicates not.
Thx anyway"
Hi Andreas, I moved your answer into a comment on your original question.

请先登录,再进行评论。

 采纳的回答

Kenneth Eaton
Kenneth Eaton 2011-1-20

7 个投票

This is the logical NOT operator, so ~isempty(E) will evaluate to true when E is not empty.

更多回答(2 个)

~ means 'not'
doc punct
At the command line will tell you other uses for ~ and the punctuation marks.
Luna
Luna 2024-4-18
  1. For what values of the variable a will the following code print 'Goodbye Mapua'?
  2. if a < 7 || a >= 4
  3. disp('Hello Mapua ')
  4. else
  5. disp('Goodbye Mapua ')
  6. end

类别

帮助中心File Exchange 中查找有关 Functions 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by