datastats
Data statistics
Syntax
xds = datastats (x)
[xds,yds] = datastats(x,y)
Description
xds = datastats (x)
returns statistics for the column vectorx
to the structurexds
. Fields inxds
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 vectorsx
andy
to the structuresxds
andyds
, respectively.xds
andyds
contain the fields listed in the table above.x
andy
must 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
Ifx
ory
contains complex values, only the real parts are used in computing the statistics. Data containingInf
orNaN
are processed using the usual MATLAB®rules.