Convert a vector from the nan_pdist function into a square matrix or from a square matrix back to the vector form.
y = nan_squareform (x) y = nan_squareform (x, "tovector") y = nan_squareform (x,"tomatrix")
Convert a vector from the pdist function into a square matrix or from a square matrix back to the vector form.
The second argument is used to specify the output type in case there is a single element
Y=(1:6)' X=nan_squareform(Y) X = 0. 1. 2. 3. 1. 0. 4. 5. 2. 4. 0. 6. 3. 5. 6. 0. nan_squareform(X) ans = 1. 2. 3. 4. 5. 6.