version 1.01 (28.4 KB) by Jeremy Hughes
Tools for simplifying for-loops. Customizable loop iteration.


Updated Tue, 25 Apr 2017 18:02:54 +0000

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

The for-each tools enable simple, readable, and powerful for loops in MATLAB(R).
For example, you can:
* Loop over the contents of a cell array without using braces for indexing,
* Convert an arbitrarily nested for-loop to a single loop using eachCombination,
* Loop through slices of an N-D array along any dimension(s),
* Loop over large numbers of permutations of a vector,
* Define your own rules for iterating over an array.
(Works from release R2009b)

Cite As

Jeremy Hughes (2022). For-Each (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: each

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!