MATLAB: How to increase the speed of this code

decrease for loops

Here, I want to generate a 3D lattice points in the form of 3 column tuples. Here is my code:
% code
pts = [];
for i = 0.01:0.01:1
for j = 0.01:0.01:1
for k = 0.01:0.01:1
a = [i j k];
pts = [pts;a];
end
end
end
end
It is too slow when I run this script in the Matlab, is there any way to increase the speed of the operation? Or is there any way to decrease the number of the for loop?
Thanks

Best Answer

Try 'ndgrid':
[X,Y,Z] = ndgrid(0.01:0.01:1);
pts = [Z(:),Y(:),X(:)]; %(Corrected)