Filter löschen
Filter löschen

addts is adding an 'x' as prefix to the timeseries name

2 Ansichten (letzte 30 Tage)
David Martinez
David Martinez am 23 Feb. 2012
Bearbeitet: hadi am 24 Okt. 2013
Hello,
I am running a simple loop where a timeseries object is created and then added to a time series collection object. The individual timeseries object that later form part of the collection have a name which is a string generated from the conversion of an integer. When the individual timeseries objects are created, the name appears to be simply the string from the integer as expected. But when the individual time series is added to the tscollection, an 'x' is added in front of the name, for no apparent reason.
Here the code:
for i = 1:size;
DataTemp(i)=timeseries(Data.PointValue(i),:),Data.DatePeriod(i),:),'Name',int2str(TempProducts(i)));
tsc=addts(tsc,DataTemp(i));
end
The name of DataTemp will simply be something like '50847' but the name of the corresponding time series when added to the collection tsc will be something like 'x50847'.
Any idea why is this happening?
Any help or suggestion would be appreciated. Kind regards,
David

Antworten (2)

Oleg Komarov
Oleg Komarov am 23 Feb. 2012
Rules for naming variables, fieldnames, etc... impose the name to start with a letter.
EDIT It is consistent.
name is a property (feature) of the timeseries object and it could be any string.
However, when forming a tscollection it tries to use the value of name to reference a specific object timeseries, but to do that it should be a valid reference, thus it has to start with a letter.

David
David am 24 Feb. 2012
Thanks Oleg. That would be a good reason. Excepts that it does not seem to be consistent for the timeseries and tscollection functions. The former allows a string name with not letter, while the latter does not (as shown above by adding series with addts).

Kategorien

Mehr zu Time Series finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by