summary(varargin)
% This function displays summary statistics in the command window and can
% be customized to display any user-defined functions on numeric data
%
% SUMMARY(x) displays summary statistics for numeric vector or matrix x
% SUMMARY(x,y,z) displays 3 column of statistics, one for each input
% variable
%
% The summary will not show variable names if the input matrix is a subset of
% a named variable. For example:
%
% data = rand(10)
% summary(data) will show "data" as the header, but
% summary(data(1:3)) will show "" as the header
%
% [NOTE 1] To customize this function to display different summary values you can add
% or remove the following strings from the cell array variable "request_str"
% in the summary.m matlab file.
%
% Formatting Strings:
% "name" - display the name of the input variable
% "blankline" - leave line blank (for clarity)
%
% Summary Strings:
% "n" - number of non NaN values
% "min" - minimum
% "max" - maximum
% "mean" - arithmetic mean
% "median" - median
% "==NaN" - number of NaNs
% "stddev" - standard deviation
% "==0" - number of zero values
% ">0" - number of positive values
% "<0" - number of negative values
%
% [NOTE 2] To further customize SUMMARY you can implement your own functions and add
% them (along with a reference string) to the function_list variable. The function
% that you define should make use of the global variable "d" or "dreal" which
% refers to the original input data, or a vector of the non-NaN data,
% respectively. The function should return a scalar.
% For instance, you could define the function frange inside this function
% to be:
%
% function r = frange()
% r = max(dreal)-min(dreal);
% end
%
% Then you would add the row {"range",@frange} to function_list variable.
% After that you can add "range" to request_str (see [NOTE 1]) to display
% the range of the input data when summary is called.
Cite As
Michael Saha (2024). summary(varargin) (https://www.mathworks.com/matlabcentral/fileexchange/47201-summary-varargin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- AI, Data Science, and Statistics > Statistics and Machine Learning Toolbox > Descriptive Statistics and Visualization > Descriptive Statistics >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.