Summary of a Table

Summary function does not take any optional argument for tables or timetables therefore, we always get the summary of entire tables. Let us see the same with the help of examples.

First, we will create a table from random vectors and then will print out its summary using the summary() function.

Matlab




% Variables
emp_id = [12; 34; 37; 45; 65];
emp_names = {'Harry'; 'Sean'; 'Mark'; 'Maria'; 'Mia'};
salaries = [1500; 5400; 2300; 3000; 9000];
 
% creating table with above variables
rec = table(emp_id,emp_names,salaries);


Output:

>> rec

rec =

  5x3 table

    emp_id      emp_names        salaries
    ______    _________    ________

      12                  {'Harry'}              1500  
      34                 {'Sean' }              5400  
      37                 {'Mark' }              2300  
      45                {'Maria'}              3000  
      65                 {'Mia' }                9000  

We have created three column vectors above and using them, we created a table named rec. This table would look like this.

Now, we will print the summary of this table by typing the following command in the command space.

Matlab




% printing summary
summary(rec)


Output:

>> summary(rec)

Variables:

    emp_id: 5x1 double

        Values:

            Min          12   
            Median       37   
            Max          65   

    emp_names: 5x1 cell array of character vectors

    salaries: 5x1 double

        Values:

            Min         1500  
            Median      3000  
            Max         9000  

Here, we can see that for the columns that contain numeric data, summary returns statistical values such as minimum, median, and maximum value whereas for the column that contains only text/character data, it simply return the size of the vector.

Print summary of table, timetable, or categorical array in MATLAB

MATLAB provides various ways to store and organize data such as tables, categorical arrays, arrays, timetables, vectors, etc. MATLAB deals with big data used for machine learning and other mathematical functions which require different organization of data. For small data it is efficient to take a look at the entire data and summarize it but, the same cannot be done when you are working with big data or binary data(.mat files).

For such situations, MATLAB provides the summary function which returns a brief summary of the data structure passed to it. It must be noted here that the summary function works only on three type of MATLAB objects:

  1. Table
  2. Timetable
  3. Categorical Array/Vector

In this article, we shall see how to use the summary function on the above-mentioned MATLAB objects.

Similar Reads

Print summary of a table, timetable, or categorical array in MATLAB

The syntax of finding summary in MATLAB for any data that can be represented in a tabular form or categorical array or a datetime frame is given by:...

Summary of a Table

Summary function does not take any optional argument for tables or timetables therefore, we always get the summary of entire tables. Let us see the same with the help of examples....

Summary of Time Tables

...

Summary of Categorical Arrays

...

1D Categorical Arrays

Summary function works in the same manner on time tables, as it works on ordinary tables. We pass the timetable object as an input and receive the summary....

Conclusion

...

Contact Us