Transforming an n-fold nested loop to a job list
Version 1.0.0 (3.69 KB) by
Thomas Schuster
An unfolding mechanism to avoid nested loops is presented.
The actual article is in the source code file. Only a summary is given here.
In order to avoid nested loops with high nesting nepth, it is necessary to unfold the loop contruct to a list-based mechanism. Particularly, if the nesting depth of the loops and the (different) lengths of the individual loops are potentially unlimited and / or only known at runtime, such a technique is required. The code is based on what I call n-dimensional index formulas. The formulas are attached as an image. The matlab functions sub2ind and ind2sub basically contain these formulas. Please download the source file and read the explanations in the comments if you are interested in such an unfolding mechanism.
Cite As
Thomas Schuster (2024). Transforming an n-fold nested loop to a job list (https://www.mathworks.com/matlabcentral/fileexchange/124895-transforming-an-n-fold-nested-loop-to-a-job-list), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2022b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
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.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |