summary(varargin)

Displays summary statistics for and input matrix in the command window
152 Downloads
Updated 28 Oct 2014

View License

% 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
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

Added support for logical input
Fixed bug where multiple summary stats are displayed

1.0.0.0