Main

## Main.MatlabConditionals History

Changed line 12 from:
=   - equal
to:
==  - equal
<iframe width="560" height="315" src="https://www.youtube.com/embed/sooT_DbbCYQ" frameborder="0" allowfullscreen></iframe>
Changed line 13 from:
<>  - not equal to
to:
~=  - not equal to
Changed lines 8-14 from:
<   -  less than
<=   -  less than or equal to
>   -  greater than
>=   -  greater than or equal to
=   -  equal
<>   -  not equal to
to:
<  - less than
<=  - less than or equal to
>  - greater than
>=  - greater than or equal to
=  - equal
<>  - not equal to
Changed lines 18-22 from:
if   -  execute code with true logical condition
and  -  return TRUE if both statements are TRUE (also &&)
or   -  return TRUE if either statement is TRUE (also ||)
not  -  return the opposite of the input TRUE/FALSE (also ~)
xor  -  exclusive OR is TRUE when both inputs differ
to:
if  - execute code with true logical condition
and - return TRUE if both statements are TRUE (also &&)
or  - return TRUE if either statement is TRUE (also ||)
not - return the opposite of the input TRUE/FALSE (also ~)
xor - exclusive OR is TRUE when both inputs differ
(:title MATLAB Conditional Statements:)
(:keywords analysis, MATLAB, Mathworks, greater than, less than, equal to:)
(:description A conditional statement is implemented into a MATLAB script to change code execution based on the result of logical statements:)

The following tutorial is an introduction to MATLAB conditional statements using the IF command and comparison statements such as those shown below.

'''Operator'''
<    -  less than
<=  -  less than or equal to
>    -  greater than
>=  -  greater than or equal to
=    -  equal
<>  -  not equal to

Certain functions such as AND, OR, XOR, and NOT can be used to combine, select, or reverse the outcome of conditional statements. These logical operations change the results based on input data.

'''Function'''
if  -  execute code with true logical condition
and  -  return TRUE if both statements are TRUE (also &&)
or  -  return TRUE if either statement is TRUE (also ||)
not  -  return the opposite of the input TRUE/FALSE (also ~)
xor  -  exclusive OR is TRUE when both inputs differ

The following video tutorial demonstrates logical operations with a number guessing game.

(:html:)
(:htmlend:)

----

(:html:)
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';