show greater than statements with 3 numbers in matlab

To show greater than statements with 3 numbers in Matlab, you can use the comparison operator ">". Here's an example:

main.m
a = 4;
b = 6;
c = 2;

if a > b && a > c
    disp('a is the greatest number');
elseif b > a && b > c
    disp('b is the greatest number');
else
    disp('c is the greatest number');
end
185 chars
12 lines

In this example, we have three variables a, b, and c. We use the ">" operator to compare each variable to the others, and using logical operators we determine which variable is the greatest.

Note that the && operator is used for "and" logical operations. This operator returns true only if both conditions are true. Finally, the disp function is used to output a message stating which variable is the greatest.

gistlibby LogSnag