Editor's Note: This file was selected as MATLAB Central Pick of the Week
R= ALLSTATS(A) returns a structure R with several statistics of vector A. A grouping factor can be given in an optional vector. In that case all the statistics will be calculated per group. The stats calculated (returned as fields of R) are:
R.min= minimum
R.max= maximum
R.mean= mean
R.std= standard deviation
R.mode= mode
R.q2p5= 2.5 percentile
R.q5= 5 percentile
R.q25= 25 percentile
R.q50= 50 percentile (median)
R.q75= 75 percentile
R.q95= 95 percentile
R.q97p5= 97.5 percentile
R.kurt= Kurtosis
R.skew= Skewness
% Example. No groups
x= rand(10,1);
R= allstats(x)
% Example. With 2 groups
g= [1;1;1;1;1;2;2;2;2;2];
R= allstats(x,g)
Cite As
Francisco de Castro (2026). Allstats (https://www.mathworks.com/matlabcentral/fileexchange/25572-allstats), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI and Statistics > Statistics and Machine Learning Toolbox > Descriptive Statistics and Visualization >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.6.0.0 | Calculation of the mode is adapted to discrete variables |
||
| 1.4.0.0 | avoid output... |
||
| 1.3.0.0 | Take into account the shape of data and groups vectors |
||
| 1.2.0.0 | Clarified help (hopefully). Included some error checking. |
||
| 1.1.0.0 | Added kurtosis and skewness |
||
| 1.0.0.0 |
