FUNCTION REFERENCE

for

Repeat statements for each column of a range or matrix.

Repeat statements for each column of a range or matrix.

Syntax

for k = start:stop, statements, end

Syntax

for k = start:step:stop, statements, end

Syntax

for k = A, statements, end

k takes one column of the right side in each pass. For a range such as 1:3 it takes 1, then 2, then 3. The browser allows 1,000,000 execution steps per run. Desktop/CLI runs have no step limit; use Stop / Ctrl+C to end a run. Use break to leave early.

Example

for k = 1:3, fprintf('%d ', k), end   % prints: 1 2 3

Differences from MATLAB: Not checked against MATLAB yet. The browser limit of 1,000,000 execution steps per run is a MatRust limit. Desktop/CLI runs have no step limit; use Stop / Ctrl+C.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.