Home MATLAB - understanding ndgrid
 I checked MATLAB's ndgrid documentation page, but didn't get the idea fully. For instance, I did the following: [x,y] = ndgrid([1,2,3],[4,5,6])  The output was: x = 1 1 1 2 2 2 3 3 3 y = 4 5 6 4 5 6 4 5 6  Why is the result displayed like this? [1 2 3] returned three times as columns, and [4 5 6] returned three times as rows? Thanks.