for

Execute statements specified number of times

Syntax

for index = values
   statements
end

Description

for index = valuesstatements, end executes a group of statements in a loop for a specified number of times.

If a colon operation with fi objects is used as the index, then the fi objects must be whole numbers.

Refer to the MATLAB® for reference page for more information.

Example

Use fi in a For Loop

Use a fi object as the index of a for-loop.

a = fi(1,0,8,0);
b = fi(2,0,8,0);
c = fi(10,0,8,0);

for x = a:b:c
 x
end

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2014b