The example image mentioned in the question is from this link : https://www.mathworks.com/help/stats/kmeans.html.
For similar results store your data in a matrix and use the same matrix in place of "X" matrix used in the code mentioned in the documentation link.