Main Content

dataset2table

R2026b

Convert dataset array to table

Description

t = dataset2table(ds) converts a dataset array to a table.

example

Examples

collapse all

Load the hospital data set, which contains simulated information for 100 hospital patients.

load hospital

Convert the dataset array to a table.

t = dataset2table(hospital)
t = 100×7 table
                 LastName       Sex      Age    Weight    Smoker    BloodPressure        Trials     
               ____________    ______    ___    ______    ______    _____________    _______________

    YPL-320    {'SMITH'   }    Male      38      176      true       124     93      {[         18]}
    GLI-532    {'JOHNSON' }    Male      43      163      false      109     77      {[   11 13 22]}
    PNI-258    {'WILLIAMS'}    Female    38      131      false      125     83      {1×0 double   }
    MIJ-579    {'JONES'   }    Female    40      133      false      117     75      {[       6 12]}
    XLK-030    {'BROWN'   }    Female    49      119      false      122     80      {[      14 23]}
    TFP-518    {'DAVIS'   }    Female    46      142      false      121     70      {[         19]}
    LPD-746    {'MILLER'  }    Female    33      142      true       130     88      {[         13]}
    ATA-945    {'WILSON'  }    Male      40      180      false      115     82      {1×0 double   }
    VNL-702    {'MOORE'   }    Male      28      183      false      115     78      {[          2]}
    LQW-768    {'TAYLOR'  }    Female    31      132      false      118     86      {[         11]}
    QFY-472    {'ANDERSON'}    Female    45      128      false      114     77      {[    8 10 14]}
    UJG-627    {'THOMAS'  }    Female    42      137      false      115     68      {[        4 9]}
    XUE-826    {'JACKSON' }    Male      25      174      false      127     74      {1×0 double   }
    TRW-072    {'WHITE'   }    Male      39      202      true       130     95      {[          8]}
    ELG-976    {'HARRIS'  }    Female    36      129      false      114     79      {1×0 double   }
    KOQ-996    {'MARTIN'  }    Male      48      181      true       130     92      {[13 15 21 27]}
      ⋮

Input Arguments

collapse all

Input dataset array to convert to a table, specified as a dataset array. Each variable in ds becomes a variable in the output table t.

Output Arguments

collapse all

Output table, returned as a table. The table can store metadata such as descriptions, variable units, variable names, and row names. For more information, see Tables.

Version History

Introduced in R2013b

See Also

|

Topics