Documentation Center

  • Trial Software
  • Product Updates

Control Flow

Conditional statements, loops, branching

MATLAB Language Syntax

if, elseif, else Execute statements if condition is true
for Execute statements specified number of times
parfor Parallel for loop
switch, case, otherwise Switch among several cases based on expression
try, catch Execute statements and catch resulting errors
while Repeatedly execute statements while condition is true
break Terminate execution of for or while loop
continue Pass control to next iteration of for or while loop
end Terminate block of code, or indicate last array index
pause Halt execution temporarily
return Return to invoking function
Was this topic helpful?