FUNCTION REFERENCE
if
Run statements only when a condition is true.
Run statements only when a condition is true.
Syntax
if condition, statements, endSyntax
if condition, statements, else, statements, endSyntax
if condition, statements, elseif condition, statements, else, statements, endThe condition is true when it is nonempty and all its elements are nonzero. Use && and || to combine scalar conditions. Write each statement block on its own lines in a script.
Example
x = 3; if x > 2, disp('big'), else, disp('small'), end % prints: bigDifferences from MATLAB: Not checked against MATLAB yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.