Loops and Conditional Statements
Control flow and branching using keywords, such as
if
,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 |
Topics
To determine which block of code to execute at run time, useif
orswitch
conditional statements.
To repeatedly execute a block of code, usefor
andwhile
loops.