squareform
Convert between condensed distance vector and square distance matrix.
📝Syntax
Z = squareform(D)
D = squareform(Z)
Y = squareform(X, direction)
📥Input Arguments
Parameter Description
D distance vector with n*(n-1)/2 elements.
Z square symmetric distance matrix.
direction 'tomatrix' or 'tovector'.
📄Description

squareform converts a condensed distance vector to a square symmetric matrix, or the reverse.

💡Examples
D = [1 2 3];
Z = squareform(D)
D2 = squareform(Z)
🔗See Also
pdist
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub