Documentation

Loops and Conditional Statements

Control flow and branching using keywords, such asif,for, andwhile

MATLAB Language Syntax

if, elseif, else Execute statements if condition is true
for for loop to repeat specified number of times
parfor Parallel for loop
switch, case, otherwise 执行几组之一statements
try, catch Execute statements and catch resulting errors
while while loop to repeat when 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 Stop MATLAB execution temporarily
return Return control to invoking script or function

Topics

Conditional Statements

To determine which block of code to execute at run time, useiforswitchconditional statements.

Loop Control Statements

To repeatedly execute a block of code, useforandwhileloops.