Main Content

timetable2table

Convert timetable to table

Description

example

T = timetable2table(TT) converts the M-by-N timetable TT to an M-by-(N+1) table. The vector of row times from TT becomes the first variable in T.

To write a timetable out to a text or spreadsheet file, use the writetimetable function.

example

T = timetable2table(TT,'ConvertRowTimes',false) converts the M-by-N timetable TT to an M-by-N table. The output T does not include the vector of row times from TT.

Examples

collapse all

Create a timetable and convert it to a table.

Time = datetime({'2015-12-18';'2015-12-19';'2015-12-20'});
Temp = [37.3;39.1;42.3];
Pressure = [29.4;29.6;30.0];
Precip = [0.1;0.9;0.0];
TT = timetable(Time,Temp,Pressure,Precip);
T = timetable2table(TT)
T=3×4 table
       Time        Temp    Pressure    Precip
    ___________    ____    ________    ______

    18-Dec-2015    37.3      29.4       0.1  
    19-Dec-2015    39.1      29.6       0.9  
    20-Dec-2015    42.3        30         0  

Display the sizes of T and TT. T has one more variable than TT because timetable2table converts the row times of TT to a variable of T.

whos T TT
  Name      Size            Bytes  Class        Attributes

  T         3x4              1739  table                  
  TT        3x3              1525  timetable              

Create a timetable.

Time = datetime({'2015-12-18';'2015-12-19';'2015-12-20'});
Temp = [37.3;39.1;42.3];
Pressure = [29.4;29.6;30.0];
Precip = [0.1;0.9;0.0];
TT = timetable(Time,Temp,Pressure,Precip)
TT=3×3 timetable
       Time        Temp    Pressure    Precip
    ___________    ____    ________    ______

    18-Dec-2015    37.3      29.4       0.1  
    19-Dec-2015    39.1      29.6       0.9  
    20-Dec-2015    42.3        30         0  

Convert TT to a table and discard its row times.

T = timetable2table(TT,'ConvertRowTimes',false)
T=3×3 table
    Temp    Pressure    Precip
    ____    ________    ______

    37.3      29.4       0.1  
    39.1      29.6       0.9  
    42.3        30         0  

Input Arguments

collapse all

Input timetable.

Extended Capabilities

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced in R2016b