Main Content

datastats

Data statistics

Syntax

xds = datastats (x)
[xds,yds] = datastats(x,y)

Description

xds = datastats (x)returns statistics for the column vectorxto the structurexds. Fields inxdsare listed in the table below.

Field

Description

num

The number of data values

max

The maximum data value

min

The minimum data value

mean

The mean value of the data

median

The median value of the data

range

The range of the data

std

The standard deviation of the data

[xds,yds] = datastats(x,y)returns statistics for the column vectorsxandyto the structuresxdsandyds, respectively.xdsandydscontain the fields listed in the table above.xandymust be of the same size.

Examples

Compute statistics for the census data incensus.mat:

load census [xds,yds] = datastats(cdate,pop) xds = num: 21 max: 1990 min: 1790 mean: 1890 median: 1890 range: 200 std: 62.048 yds = num: 21 max: 248.7 min: 3.9 mean: 85.729 median: 62.9 range: 244.8 std: 78.601

Tips

Ifxorycontains complex values, only the real parts are used in computing the statistics. Data containingInforNaNare processed using the usual MATLAB®rules.

Version History

Introduced before R2006a

See Also

|