If you run into memory issues when processing a large 2D or 3D matrix, but looping through every grid cell individually is too slow, go for the middle ground and break the matrix up into bite-size tiles. Check out the Examples tab above to see how it works.
Chad Greene (2019). tile (https://www.mathworks.com/matlabcentral/fileexchange/69992-tile), MATLAB Central File Exchange. Retrieved .
Create scripts with code, output, and formatted text in a single executable document.