Main Content

groupedData2table

Convert groupedData object to table

Description

example

tbl = groupedData2table(grpData) converts a groupedData object grpData to a table.

Examples

collapse all

Load the sample data set.

load pheno.mat ds

Create a groupedData object from the data set ds.

grpData = groupedData(ds);

Display the object properties.

grpData.Properties
ans = struct with fields:
                Description: ''
                   UserData: []
             DimensionNames: {'Observations'  'Variables'}
              VariableNames: {'ID'  'TIME'  'DOSE'  'WEIGHT'  'APGAR'  'CONC'}
       VariableDescriptions: {}
              VariableUnits: {}
         VariableContinuity: []
                   RowNames: {}
           CustomProperties: [1x1 matlab.tabular.CustomProperties]
          GroupVariableName: 'ID'
    IndependentVariableName: 'TIME'

GroupVariableName and IndpendentVariableName have been automatically assigned to 'ID' and 'Time', respectively.

Convert the groupedData to a table.

tbl = groupedData2table(grpData);

Display the first 5 rows of the table.

tbl(1:5,:)
ans=5×6 table
    ID    TIME    DOSE    WEIGHT    APGAR    CONC
    __    ____    ____    ______    _____    ____

    1        0     25      1.4        7       NaN
    1        2    NaN      1.4        7      17.3
    1     12.5    3.5      1.4        7       NaN
    1     24.5    3.5      1.4        7       NaN
    1       37    3.5      1.4        7       NaN

Input Arguments

collapse all

Grouped data, specified as a groupedData object.

Output Arguments

collapse all

Data table, returned as a table.

Version History

Introduced in R2014a