Azzera filtri
Azzera filtri

Timeseries can't be subscripted in R2012a?

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Sean de Wolski
Sean de Wolski il 12 Set 2012
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 Commenti
Adee
Adee il 19 Set 2012
Can I ask that this change of behavior be documented?
Regards,
Adee

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Time Series Collections in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by