In order to use greater than operator in if-else statement in Matlab, you can use the following syntax:
main.m77 chars6 lines
Here, if variable1 is greater than variable2, then the code block inside the if statement will be executed, otherwise the code block inside the else statement will be executed.
For example, consider the following code snippet:
main.m179 chars11 lines
Output:
main.m20 chars2 lines
In this example, x is not greater than y, hence the code inside the else statement is executed which displays the message 'y is greater than x'.
gistlibby LogSnag