What does a = b+c ~= d/e mean?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Laura Costa Pereira Miranda
am 4 Mär. 2023
Kommentiert: Walter Roberson
am 6 Mär. 2023
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
0 Kommentare
Akzeptierte Antwort
Voss
am 4 Mär. 2023
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 Kommentare
Walter Roberson
am 6 Mär. 2023
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
if -4:2:4; disp('yep okay'); else disp('nope'); end
The first one is completely non-zero but the second one contains at least one zero.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!