ndimgrid(bounds,ste​ps)

Version 1.2.0.0 (1.09 KB) by Rod
Returns a matrix of points in n-dimensional space comprising a grid
22 Downloads
Updated 17 Feb 2016

View License

Similar to the meshgrid() function, this script will return a matrix where each row is a point in n-dimensional space.
Bounds specifies the limits of the grid in each dimension, steps specifies the number of points in each dimension.
example:
bounds = [1, 1; 5,5];
steps = [5 , 5];
Grid = ndimgrid(bounds,steps);

Grid =

1 1
2 1
3 1
4 1
5 1
1 2
2 2
3 2
4 2
5 2
1 3
2 3
3 3
4 3
5 3
1 4
2 4
3 4
4 4
5 4
1 5
2 5
3 5
4 5
5 5

Hope this helps someone else

Cite As

Rod (2024). ndimgrid(bounds,steps) (https://www.mathworks.com/matlabcentral/fileexchange/55464-ndimgrid-bounds-steps), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Linear Algebra in Help Center and MATLAB Answers
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2.0.0

Changed ordering of grid

1.1.0.0

changed ordering of bounds

1.0.0.0