FUNCTION REFERENCE
ndgrid
Create a 2-D grid with x varying down rows.
Create a 2-D grid with x varying down rows.
Syntax
[X,Y] = ndgrid(x, y)Syntax
[X,Y] = ndgrid(x)Syntax
X = ndgrid(x)Two outputs have size numel(x)-by-numel(y). Each column of X repeats x, and each row of Y repeats y. With one input and two outputs, y equals x. With one input and one output, x is returned as a column. Real numeric and logical inputs are accepted; matrix inputs are read in column order.
Example
[X,Y]=ndgrid(1:3,1:2); X % [1 1; 2 2; 3 3]Example
[A,B,C]=ndgrid(1:3,1:2,1:4); size(A) % [3 2 4]Differences from MATLAB: Complex inputs are not supported. Grids with three or more dimensions take real vectors.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.