settimeseriesnames

Renames a time series inside a tscollection.

Category: Language Fundamentals > Data Types

Syntax

tsc = settimeseriesnames(tsc, oldname, newname)

Renames the member oldname to newname.

Description

Members of a tscollection are addressed by name, so renaming changes how they are accessed afterwards. The new name must be a valid identifier that is not already used by another member. gettimeseriesnames lists the current names.

Input arguments

tsc
A tscollection object.
newname, oldname
New and current names of the series.

Output arguments

tsc
The collection with the member renamed.

Example

ts1 = timeseries([1 2 3]', [0 1 2], 'Name', 'a');
ts2 = timeseries([4 5 6]', [0 1 2], 'Name', 'b');
tsc = tscollection({ts1, ts2});
gettimeseriesnames(tsc)
tsc = settimeseriesnames(tsc, 'b', 'z');
Output
ans = 1×2 cell

    {'a'}    {'b'}

Call gettimeseriesnames again afterwards to see the new name.

See also

gettimeseriesnames tscollection removets addts