data every second. want matrix with mean data of every minute.

1 回表示 (過去 30 日間)
torres
torres 2018 年 6 月 7 日
コメント済み: torres 2018 年 6 月 9 日
I have a matrix of 7 colums. aaaa mm dd hh mm ss , the last column is a value. I have a data every second, and I need to extract one value every minute. This value has to be the mean of every data in this minute. Result must be rows:aaaa mm dd HH MM value.
Thank you very much in advance

採用された回答

sloppydisk
sloppydisk 2018 年 6 月 7 日
Use retime and datetime:
a = ones(100, 7);
a(:, 7) = randi(15, 100, 1);
mins = repmat(1:10, 10, 1); a(:, 5) = mins(:);
b = datetime(a(:, 1),a(:, 2),a(:, 3),a(:, 4),a(:, 5),a(:, 6));
value = a(:, 7);
TT1 = timetable(b,value);
newTimes = b(1, :):minutes(1): b(end, :);
TT2 = retime(TT1,newTimes,'mean')
  1 件のコメント
torres
torres 2018 年 6 月 9 日
Thank you very much. It has been very easy to implement for my pursposes. It´s a pleasure to have this share of knowledge.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by