For-Each
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 (https://www.mathworks.com/matlabcentral/fileexchange/48729-for-each), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: each
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.