Page 1 of 1

Conditionals: IF statement examples

Posted: Thu Jan 06, 2022 2:43 pm
by amh
IF statement example in MATLAB.

if the Z value negative, it will display negative, vice versa in positive case.

Code: Select all

z = -10;
if (z < 0)
disp('negative');
else
disp('positive');
end