Timeseries can't be subscripted in R2012a?

I'm transitioning from R2009b to R2012a.
In R2009b I was able to extract samples from a timeseries by subscript. For example
t=(0:0.01:2)';
ts=timeseries(sin(2*pi*t), t);
plot(ts(1:100))
This would plot the first half of the timeseries.
In R2012a, this code causes the error message "Index exceeds matrix dimensions."
The function timeseries/subsref.m seems to be missing from R2012a... there was no message that it's usage is deprecated or anything.
Is this a known problem? any workaround (hopefully without rewriting existing code?)
Thanks
Adee

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 9월 12일

0 개 추천

In R2012b, ts is a 1x1 scalar object, you'll have to access its properties directly:
plot(ts.Time(1:100),ts.Data(1:100))

댓글 수: 2

Adee
Adee 2012년 9월 19일
Can I ask that this change of behavior be documented?
Regards,
Adee
Sean de Wolski
Sean de Wolski 2012년 9월 19일
Hi Adee, I would guess this is the change that did it (R2010b)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Time Series에 대해 자세히 알아보기

태그

질문:

2012년 9월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by