timetable2table
将时间表转换为表
说明
T = timetable2table(
将 TT
)M
×N
时间表 TT
转换为 M
×(N+1)
表。TT
中的行时间向量成为 T
中的第一个变量。
要将时间表写为文本文件或电子表格文件,请使用 writetimetable
函数。
示例
将时间表转换为表
创建时间表并将其转换为表。
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
显示 T
和 TT
的大小。T
比 TT
多一个变量,因为 timetable2table
将 TT
的行时间转换为 T
的变量。
whos T TT
Name Size Bytes Class Attributes T 3x4 1739 table TT 3x3 1525 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
将 TT
转换为表并丢弃其行时间。
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
输入参数
TT
— 输入时间表
时间表
输入时间表。
扩展功能
tall 数组
对行数太多而无法放入内存的数组进行计算。
此函数完全支持 tall 数组。有关详细信息,请参阅 tall 数组。
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
用法说明和限制:
如果输入时间表的
UserData
属性具有非空值,则输出不包括该值。输出表的UserData
属性始终为空。
有关详细信息,请参阅 表的代码生成 (MATLAB Coder) 和 Table Limitations for Code Generation (MATLAB Coder)。
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
分布式数组
使用 Parallel Computing Toolbox™ 在集群的组合内存中对大型数组进行分区。
此函数完全支持分布式数组。有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
版本历史记录
在 R2016b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)