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 Kommentare

Todd Flanagan
Todd Flanagan am 20 Jan. 2011
Andreas say, "I found it. ~ indicates not.
Thx anyway"
Todd Flanagan
Todd Flanagan am 20 Jan. 2011
Hi Andreas, I moved your answer into a comment on your original question.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Kenneth Eaton
Kenneth Eaton am 20 Jan. 2011

7 Stimmen

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

Weitere Antworten (2)

Doug Hull
Doug Hull am 20 Jan. 2011

9 Stimmen

~ means 'not'
doc punct
At the command line will tell you other uses for ~ and the punctuation marks.
Luna
Luna am 18 Apr. 2024

0 Stimmen

  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

Kategorien

Produkte

Tags

Gefragt:

am 20 Jan. 2011

Beantwortet:

am 18 Apr. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by