

Now let us consider one example to check the given number is within range or not. Screen 3 B: the output of example 3 Example #4 – Use of Logical Operators Screen 3 A shows the Matlab code of example 3 and screen 3 B shows the output of example 3.

If ( a c ) - nested if condition 4ĭisp ( ' b is max ' ) if condition 4 is true if condition 2 is trueĭisp ( ' c is maximum ' ) -if condition 2 is false

In this example, we will see a maximum of three numbers, let us consider three numbers a, b and c. Screen 2: Matlab implementation of example 2 Example #3 – Use of Nested if Statement Screen 2 shows the Matlab implementation of example 2. If a = 5 then we will find the number a is less than 10 or not.ĭisp ( ' a is maximum ' ) - condition 1 is trueĭisp (' b is minimum ' ) -condition 1 is false Let us consider an example to find a large or less than a specific number. Here are some examples of the if-else statement in Matlab which are given below: Example #1 – Simple If-Else Statements Hadoop, Data Science, Statistics & others Examples of If-Else Statement in Matlab
