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

3 次查看(过去 30 天)
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)

采纳的回答

Voss
Voss 2023-10-31
AA = cellfun(@(dd,tt)timeseries(dd,tt),Y,t,'UniformOutput',false);
  6 个评论
yamid
yamid 2023-10-31
编辑:yamid 2023-10-31
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?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time Series 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by