What does a = b+c ~= d/e mean?

조회 수: 6 (최근 30일)
Laura Costa Pereira Miranda
Laura Costa Pereira Miranda 2023년 3월 4일
댓글: Walter Roberson 2023년 3월 6일
Hi!
I have a situation in my code like this:
a = b+c ~= d/e;
where a, b, c, d and e are real numbers, but I don't know what this expression means...
Can you help me, please?
Thank you! :D

채택된 답변

Voss
Voss 2023년 3월 4일
a = b+c ~= d/e;
for scalars b, c, d, and e, is the same as
if b+c ~= d/e
a = true;
else
a = false;
end
  댓글 수: 6
Voss
Voss 2023년 3월 6일
You're welcome!
Walter Roberson
Walter Roberson 2023년 3월 6일
By the way, in the context of if or while then an expression is considered true if the expression evaluates to something that is all non-zero (if it evaluates to contain nan then you will get an error)
if -3:2:5; disp('yep okay'); else disp('nope'); end
yep okay
if -4:2:4; disp('yep okay'); else disp('nope'); end
nope
The first one is completely non-zero but the second one contains at least one zero.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by