tscollection
创建 tscollection
对象
说明
tscollection
对象是一个或多个具有相同时间向量的 timeseries
对象的集合。timeseries
的集合对于分析同时发生的多个数据趋势很有用。
创建对象
要创建 tscollection
对象,请使用 tscollection
函数。
描述
输入参数
ts
— 输入 timeseries
标量 | 元胞数组
输入 timeseries
,指定为标量或元胞数组。
timevals
— 采样时间
标量 | 向量
采样时间,指定为数值标量或向量,或指定为日期字符向量元胞数组。有效日期字符向量可以采用以下格式:
格式 | 示例 |
---|---|
“dd-mmm-yyyy HH:MM:SS ” | 01-Mar-2000 15:45:17 |
“dd-mmm-yyyy ” | 01-Mar-2000 |
“mm/dd/yy ” | 03/01/00 |
“mm/dd ” | 03/01 |
“HH:MM:SS ” | 15:45:17 |
“HH:MM:SS PM ” | 3:45:17 PM |
“HH:MM ” | 15:45 |
“HH:MM PM ” | 3:45 PM |
“mmm.dd,yyyy HH:MM:SS ” | Mar.01,2000 15:45:17 |
“mmm.dd,yyyy ” | Mar.01,2000 |
“mm/dd/yyyy ” | 03/01/2000 |
数据类型: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| cell
将可选的参数对组指定为 Name1=Value1,...,NameN=ValueN
,其中 Name
是参数名称,Value
是对应的值。名称-值参数必须出现在其他参数之后,但参数对组的顺序无关紧要。
在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: tsc = tscollection(ts,'Name','MyTSC')
Name
— tscollection
名称
字符向量
tscollection
名称,指定为字符向量。
isDatenum
— datenum
指示符
true
(默认) | false
datenum
指示符,指定为 true
或 false
。值为 true
表示 tscollection
对象的时间向量由 datenum
值组成。有关详细信息,请参阅 datenum
。
数据类型: logical
属性
Name
— tscollection
名称
字符向量
tscollection
名称,以字符向量的形式表示。
Time
— 时间值
向量
时间值,表示为向量。
如果 TimeInfo.StartDate
为空,将相对于 0
测量值。定义 TimeInfo.StartDate
时,值表示相对于 StartDate
测量的日期字符向量。
Time
的长度必须与每个集合的 Data
的第一个或最后一个维度相同。
TimeInfo
— 时间信息
字段的集合
时间信息,表示为描述时间向量的以下字段的集合:
Units
- 时间单位,其值为'weeks'
、'days'
、'hours'
、'minutes'
、'seconds'
、'milliseconds'
、'microseconds'
或'nanoseconds'
。Start
- 开始时间。End
- 结束时间(只读)。Increment
- 后续时间值之间的间隔(如果时间采样不均匀,则为NaN
)。Length
- 时间向量的长度(只读)。Format
- 定义日期显示的字符向量(请参阅datestr
)。StartDate
- 定义参考日期的日期字符向量(请参阅setabstime
)。UserData
- 其他的用户定义信息。
要访问 tscollection
对象 tsc
某个字段的值,请使用 tsc.TimeInfo.field
语法形式进行访问。
对象函数
修改与合并
addsampletocollection | 向 tscollection 添加样本 |
addts | 将 timeseries 添加到 tscollection 中 |
delsamplefromcollection | 从 tscollection 中删除样本 |
horzcat | 水平串联 tscollection 对象 |
removets | 从 tscollection 中删除 timeseries |
resample | 对 tscollection 时间向量重采样 |
set | 设置 tscollection 的属性 |
setabstime | 将 tscollection 时间设置为日期字符向量 |
settimeseriesnames | 重命名 tscollection 中的 timeseries |
vertcat | 垂直串联 tscollection 对象 |
查询
get | 查询 tscollection 属性 |
getabstime | 将 tscollection 时间向量转换为元胞数组 |
getsampleusingtime | tscollection 数据的子集 |
gettimeseriesnames | tscollection 中的 timeseries 的名称 |
isempty | 确定 tscollection 是否为空 |
length | tscollection 时间向量的长度 |
size | tscollection 的大小 |
示例
创建 tscollection
使用两个 timeseries
对象创建一个 tscollection
对象。
ts1 = timeseries([1.1 2.9 3.7 4.0 3.0]',1:5,... 'Name','Acceleration'); ts2 = timeseries([3.2 4.2 6.2 8.5 1.1]',1:5,... 'Name','Speed'); ts = tscollection({ts1;ts2})
Time Series Collection Object: unnamed Time vector characteristics Start time 1 seconds End time 5 seconds Member Time Series Objects: Acceleration Speed
版本历史记录
在 R2006a 之前推出
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)