timetable2table
将时间表转换为表
说明
示例
创建一个时间表。
Time = datetime(["2025-12-18";"2025-12-19";"2025-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-2025 37.3 29.4 0.1
19-Dec-2025 39.1 29.6 0.9
20-Dec-2025 42.3 30 0
将 TT 转换为表。来自时间表的行时间向量成为输出表的一个变量。因此,当时间表具有一个行时间向量和三个变量时,表具有四个变量。
T = timetable2table(TT)
T=3×4 table
Time Temp Pressure Precip
___________ ____ ________ ______
18-Dec-2025 37.3 29.4 0.1
19-Dec-2025 39.1 29.6 0.9
20-Dec-2025 42.3 30 0
显示输入时间表的属性。由于时间表是表的一种类型,它具有表所具有的属性,例如 VariableNames。但它也具有仅与时间表相关的属性,例如 RowTimes。
TT.Properties
ans =
TimetableProperties with properties:
Description: ''
UserData: []
DimensionNames: {'Time' 'Variables'}
VariableNames: {'Temp' 'Pressure' 'Precip'}
VariableTypes: ["double" "double" "double"]
VariableDescriptions: {}
VariableUnits: {}
VariableContinuity: []
RowTimes: [3×1 datetime]
StartTime: 18-Dec-2025
SampleRate: NaN
TimeStep: 1d
Events: []
CustomProperties: No custom properties are set.
Use addprop and rmprop to modify CustomProperties.
显示输出表的属性。timetable2table 函数丢弃 RowTimes、StartTime、SampleRate、TimeStep 和 Events 属性。
T.Properties
ans =
TableProperties with properties:
Description: ''
UserData: []
DimensionNames: {'Row' 'Variables'}
VariableNames: {'Time' 'Temp' 'Pressure' 'Precip'}
VariableTypes: ["datetime" "double" "double" "double"]
VariableDescriptions: {}
VariableUnits: {}
VariableContinuity: []
RowNames: {}
CustomProperties: No custom properties are set.
Use addprop and rmprop to modify CustomProperties.
创建一个时间表。
Time = datetime(["2025-12-18";"2025-12-19";"2025-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-2025 37.3 29.4 0.1
19-Dec-2025 39.1 29.6 0.9
20-Dec-2025 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
输入参数
输入时间表。
扩展功能
timetable2table 函数完全支持 tall 数组。有关详细信息,请参阅 tall 数组。
请参阅“C/C++ 代码生成”部分中的用法说明和限制。同样的用法说明和限制也适用于 GPU 代码生成。
基于线程的环境
使用 MATLAB® backgroundPool 在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool 加快代码运行速度。
timetable2table 函数完全支持分布式数组。有关详细信息,请参阅使用分布式数组运行 MATLAB 函数 (Parallel Computing Toolbox)。
版本历史记录
在 R2016b 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)