필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
David Martinez
David Martinez 2012년 2월 23일
편집: hadi 2013년 10월 24일
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

답변 (2개)

Oleg Komarov
Oleg Komarov 2012년 2월 23일
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 2012년 2월 24일
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).

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by