'retime' with multiple methods?

3 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 7 月 7 日
編集済み: alpedhuez 2020 年 7 月 7 日
'retime' uses a method to aggregate data
TT3 = retime(TT,'hourly','mean')
Is it possible to use two methods to calculate mean and standad deviation,
TT3 = retime(TT,'hourly',{'mean','@std'}) (this does not work)
Or is it possible to have a function manipulation?
TT3 = retime(TT,'hourly',@std*@mean) (this does not work)
  3 件のコメント
Adam Danz
Adam Danz 2020 年 7 月 7 日
The documentation for retime > method states that method can be character vector | string scalar | function handle and the function handle must return a scalar. You can use the mean and std separately and then combine the output tables.
alpedhuez
alpedhuez 2020 年 7 月 7 日
編集済み: alpedhuez 2020 年 7 月 7 日
To Rik: if you explain a bit more I will work on it.
To Adam: I did. But try to simplify.

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

採用された回答

Steven Lord
Steven Lord 2020 年 7 月 7 日
If you want to return the product of the standard deviation and the mean for the data in each time period, something like this (which I have not tried) should work:
TT3 = retime(TT, 'hourly', @(x) std(x)*mean(x))
As stated on the documentation page for retime the method input may be a function handle, but if it is it "must return an output argument that is a scalar or a row vector, and must accept empty inputs."
If you want to apply multiple methods to the variables in your timetable see the "Apply Multiple Methods to Timetable" example on the documentation page to which I linked earlier.
  1 件のコメント
alpedhuez
alpedhuez 2020 年 7 月 7 日
編集済み: alpedhuez 2020 年 7 月 7 日
Great help!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by