<< nan_spearman Descriptive Statistics nan_statistic >>

NaN Toolbox >> NaN Toolbox > Descriptive Statistics > nan_squareform

nan_squareform

Convert a vector from the nan_pdist function into a square matrix or from a square matrix back to the vector form.

Calling Sequence

y = nan_squareform (x)
y = nan_squareform (x, "tovector")
y = nan_squareform (x,"tomatrix")

Description

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

Examples

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.

See also

Authors


<< nan_spearman Descriptive Statistics nan_statistic >>