Datasets with different Time series

3 ビュー (過去 30 日間)
FIONA HOTCHKISS
FIONA HOTCHKISS 2021 年 12 月 9 日
コメント済み: KSSV 2021 年 12 月 9 日
average_data=[];
num_of_data=numel(PBCO2);
for i=1:num_of_data;
average_current=(PBCO2(i)+LJCO2(i)+MLCO2(i)+ASCO2(i)+NZCO2(i))/5;
average_data=[average_data;average_current];
end
"Index exceeds number of array elements (492)"
I am working with 5 different datasets in an array. They start at different dates but all go until the present, and I think that is what is causing my issue. How can I get all of them to pull from the same start time? For example I have one starting in 1961 and another in 1981, how can I get all of them to start pulling the data beginning 1981. If this is not the reason for the Error, what could the reason be and how do I fix it?

回答 (1 件)

KSSV
KSSV 2021 年 12 月 9 日
Pick all the data to have same time and see if they have same dimensions. If they don't have same dimensions, get them to same dimension using interp1.
  2 件のコメント
FIONA HOTCHKISS
FIONA HOTCHKISS 2021 年 12 月 9 日
How would I get my data to have the same dimesions?
KSSV
KSSV 2021 年 12 月 9 日
As you have the dates, pick the common dates out of all, use ismember for this; get the same dimensions using interp1.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by