Data statistics
xds = datastats(x)
[xds,yds] = datastats(x,y)
xds = datastats(x)
returns statistics for
the column vector x
to the structure xds
.
Fields in xds
are listed in the table below.
Field | Description |
---|---|
| The number of data values |
| The maximum data value |
| The minimum data value |
| The mean value of the data |
| The median value of the data |
| The range of the data |
| The standard deviation of the data |
[xds,yds] = datastats(x,y)
returns
statistics for the column vectors x
and y
to
the structures xds
and yds
, respectively.
xds
and yds
contain the fields listed in
the table above. x
and y
must be of the same
size.
Compute statistics for the census data in census.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
If x
or y
contains complex values, only the
real parts are used in computing the statistics. Data containing Inf
or NaN
are processed using the usual
MATLAB® rules.