MATLAB Answers

What does a "~" mean in the following code

385 views (last 30 days)
Andreas
Andreas on 20 Jan 2011
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 Comments
Todd Flanagan
Todd Flanagan on 20 Jan 2011
Hi Andreas, I moved your answer into a comment on your original question.

Sign in to comment.

Accepted Answer

Kenneth Eaton
Kenneth Eaton on 20 Jan 2011
This is the logical NOT operator, so ~isempty(E) will evaluate to true when E is not empty.

More Answers (1)

Doug Hull
Doug Hull on 20 Jan 2011
~ means 'not'
doc punct
At the command line will tell you other uses for ~ and the punctuation marks.

Tags

Products

Community Treasure Hunt

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

Start Hunting!