addts is adding an 'x' as prefix to the timeseries name
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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.
0 个评论
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 Center 和 File Exchange 中查找有关 Time Series 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!