get summary statistics in matlab of a table in matlab

You can use the summary function in Matlab to get summary statistics of a table. Here is an example:

main.m
% create a table
age = [21; 25; 30; 22; 27; 32; 24; 29];
gender = {'M'; 'F'; 'F'; 'M'; 'F'; 'M'; 'F'; 'M'};
salary = [35000; 45000; 55000; 40000; 50000; 60000; 42000; 52000];
T = table(age, gender, salary);

% get summary statistics
summary(T)
244 chars
9 lines

This will display the following summary statistics for each variable in the table:

main.m
age:
            min       21
            median    26
            max       32
            <undefined> 0
gender: 
            M         4
            F         4
salary:     
            min       35000
            median    47000
            max       60000
            <undefined> 0
286 chars
14 lines

Here, we see the minimum, median and maximum values for the age and salary variables, as well as the frequency of each unique value for the gender variable.

gistlibby LogSnag