In the previous post, I have learned that
[X, Y] = meshgrid(0:.1:0.5); [X(:), Y(:)]
will create a matrix
0 0 0 0.1 0 0.2 ...
Now I want to generalize to
[X, Y, Z] = meshgrid(0:.1:0.5); [X(:), Y(:), Z(:)]
and it creates a matrix
ans = 216×3 0 0 0 0 0.1000 0 0 0.2000 0 0 0.3000 0 0 0.4000 0 0 0.5000 0 0.1000 0 0 0.1000 0.1000 0 0.1000 0.2000 0 0.1000 0.3000 0
But the matrix I want to create is like
0 0 0 0 0 0.10 0 0.20 0 0.30 0 0.40 0 0.50 0.1 0.10 0.1 0.20 0.1 0.3
Please advise.
Best Answer