Convert two cell arrays (time values and data values) to one cell array of timeseries

3 visualizaciones (últimos 30 días)
Hello all.
I have two cell arrays: t and y. Cell t contains the time values of 200 timeseries. Y contains the data values of 200 timeseries. The size of Y and t are 1x200. Each elemnt is a 1D vector.
How can I create a new cell array AA with a size of 1x200, whose elements are the reconstructed timeseries from elemnts of t and Y. Please note that "timeseries" are the matlab format of timeseries(datavals,timevals)

Respuesta aceptada

Voss
Voss el 31 de Oct. de 2023
AA = cellfun(@(dd,tt)timeseries(dd,tt),Y,t,'UniformOutput',false);
  6 comentarios
yamid
yamid el 31 de Oct. de 2023
Editada: yamid el 31 de Oct. de 2023
Thank you, Voss. After resampling, the cell array BB contains several timeseries that have lots of NaN values (due to extrapolation). Is there a way to remove all those data points from each timeseries in BB that have NaN in Time and Data?
Voss
Voss el 31 de Oct. de 2023
BB = cellfun(@(tsin)delsample(tsin,'Index',find(isnan(tsin.Data))),BB,'UniformOutput',false);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Time Series en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by