Scilab Website | Contribute with GitLab | Scilab Community | ATOMS toolboxes
Scilab Online Help
2027.0.0 - Português


summary

Summary statistics for matrices, tables or timeseries

Syntax

summary(X)
summary(X, dim)
summary(X, dim, statistics)
S = summary(X [, dim, statistics])

summary(t)
summary(t, statistics)
summary(t, statistics, datavars)
S = summary(t, statistics, datavars)

Arguments

X

matrix of doubles, integers, booleans, strings, durations or datetimes.

dim

dimension along which statistics are computed.

Accepted values are:

  • 1 or "r": compute statistics by column.

  • 2 or "c": compute statistics by row.

Default value is 1.

t

table or timeseries object.

statistics

string (optional). Specifies which statistics to compute. Possible values are:

  • "default" (default value): computes a standard set of statistics (NumMissing, Min, Median, Max, Mean, Std)

  • "none": no statistics are computed

  • "allstats": computes all available statistics

Statistics may also be a string vector containing individual statistics names.

datavars

string (optional). Only for tables and timeseries. Names of variables to include in the summary. Default is "all", meaning all variables are summarized.

S

A structure containing the summary information for each variable.

Description

summary() provides a concise overview of the contents of an array, table or timeseries. Depending on the data type, it reports descriptive statistics, metadata and missing value information. summary is intended as a quick exploratory tool for inspecting data before further analysis.

For numeric, datetime and duration data, summary computes descriptive statistics such as minimum, maximum, median, mean and standard deviation.

For boolean and string data, summary reports value distributions and occurrence counts.

For tables and timeseries, summary processes each variable independently and also reports variable metadata such as descriptions and units.

If no output argument is specified, the summary is displayed in the console. When an output argument is requested, summary returns a structure. For arrays, statistics are stored at the first level of the returned structure. For tables and timeseries, statistics are stored inside the structure associated with each variable. (see Output Structure section)

Output Structure

When an output argument is provided, summary() returns a structure containing the computed information.

The organization of the returned structure depends on the input data type.

Matrices

For matrices, each field of the structure corresponds to a computed statistic.

x = [1 2 3 ; 4 5 %nan];
S = summary(x, 1, ["Mean","Std"]);
fieldnames(S)
// Mean
// Std

The value stored in each field contains one element per summarized row or column.

Tables and Timeseries

For tables and timeseries, the returned structure contains one field per summarized variable.

Each variable field contains metadata and the requested statistics.

Supported Statistics for Numeric Data

Depending on the selected options, the following statistics may be computed:

  • NumMissing: number of missing values (%nan or NaT)

  • Min: minimum value

  • Max: maximum value

  • Median: median value

  • Mean: mean value

  • Std: standard deviation

  • Var: variance

  • Q1: first quartile (25th percentile)

  • Q3: third quartile (75th percentile)

  • Mode: mode

  • Range: range of values

  • Sum: sum of values

  • NumUnique: number of unique non-missing values

  • Nnz: number of non-zero values

Supported numeric-like types include double, integer, duration and datetime values.

Boolean Variables

For boolean variables, the summary reports:

  • True: number of true values

  • False: number of false values

String Variables

For string variables, the summary reports:

  • NumMissing: number of undefined values

  • Values: unique string values

  • Counts: occurrence count of each value

Missing Values

Missing values (%nan and NaT) are ignored when computing descriptive statistics. Their number is reported by the NumMissing statistic.

Examples

x = [1 2 3;
    4 5 %nan];
summary(x)
// [Size type]: [2x3 constant]
// 
//                   Col1        Col2      Col3
//                 _________   _________   ____
//                                             
//    NumMissing   0           0           1   
//           Min   1           2           3   
//        Median   1           2           3   
//           Max   4           5           3   
//          Mean   2.5         3.5         3   
//           Std   2.1213203   2.1213203   0   

S = summary(x, 1, ["Mean","Std"])
// S = [struct] with fields:
//
//  Mean = [2.5,3.5,3]
//  Std = [2.1213203,2.1213203,0]

// Create a table
t = table([1; 2; %nan], [10; 20; 30], ...
"VariableNames", ["A", "B"]);
t.Properties.VariableDescriptions = ["First variable", "Second variable"];
t.Properties.VariableUnits = ["m", "s"];

// Display default summary
summary(t)

// Summary without statistics
summary(t, "none")

// Summary with all statistics
summary(t, "allstats")

// Summary for selected variables
summary(t, "default", "A")

// Return summary as a structure
S = summary(t)
disp(S.A.Mean)
--> t = table([1; 2; %nan], [10; 20; 30], ...
  >           "VariableNames", ["A", "B"]);

--> t.Properties.VariableDescriptions = ["First variable", "Second variable"];

--> t.Properties.VariableUnits = ["m", "s"];

// Display default summary

--> summary(t)

 table: [3x2 table]

 Variables:
     A: double
        Description: First variable
        Units: m
     B: double
        Description: Second variable
        Units: s

 Statistics for numeric data:
                    A        B 
                _________   ___
                               
   NumMissing   1           0  
          Min   1           10 
       Median   1           20 
          Max   2           30 
         Mean   1.5         20 
          Std   0.7071068   10 

// Summary without statistics

--> summary(t, "none")

 table: [3x2 table]

 Variables:
     A: double
        Description: First variable
        Units: m
     B: double
        Description: Second variable
        Units: s

// Summary with all statistics

--> summary(t, "allstats")

 table: [3x2 table]

 Variables:
     A: double
        Description: First variable
        Units: m
     B: double
        Description: Second variable
        Units: s

 Statistics for numeric data:
                    A        B 
                _________   ___
                               
   NumMissing   1           0  
          Min   1           10 
       Median   1           20 
          Max   2           30 
           Q1   1           10 
         Mean   1.5         20 
           Q3   2           30 
          Std   0.7071068   10 
          Var   0.5         100
         Mode   1           10 
        Range   1           20 
          Sum   3           60 
    NumUnique   2           3  
          Nnz   2           3  

// Summary for selected variables

--> summary(t, "default", "A")

 table: [3x2 table]

 Variables:
     A: double
        Description: First variable
        Units: m

 Statistics for numeric data:
                    A    
                _________
                         
   NumMissing   1        
          Min   1        
       Median   1        
          Max   2        
         Mean   1.5      
          Std   0.7071068

// Return summary as a structure

--> S = summary(t)

 S = [struct] with fields:

  A: [struct] with fields:
      Size = [3,1]
      Type = "double"
      Description = "First variable"
      Units = "m"
      NumMissing = 1
      Min = 1
      Median = 1
      Max = 2
      Mean = 1.5
      Std = 0.7071068
  B: [struct] with fields:
      Size = [3,1]
      Type = "double"
      Description = "Second variable"
      Units = "s"
      NumMissing = 0
      Min = 10
      Median = 20
      Max = 30
      Mean = 20
      Std = 10

--> disp(S.A.Mean)

   1.5

See also

  • table — create a table from variables
  • timeseries — create a timeseries - table with time as index

History

VersãoDescrição
2026.1.0 Function added.
2027.0.0

Support for matrices of doubles, integers, booleans, strings, durations and datetimes added.

Report an issue
<< struct2table Timeseries/Table synchronize >>

Copyright (c) 2022-2026 (Dassault Systèmes S.E.)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 15 11:19:59 CEST 2026