How can I change the retime function in order to do a median(A,'omitnan')?

5 ビュー (過去 30 日間)
Mara Meggiorin
Mara Meggiorin 2019 年 7 月 18 日
コメント済み: Steven Lord 2019 年 7 月 18 日
Hi, I would like to use retime to calculate monthly median.
I tried to use median as a function and it works if I do not specify anything but I I want to add 'omitnan' it does not work.
It gives:
retime(Liv_dom_an, 'monthly', @median(Liv_dom_an{:,:},'omitnan'))
Error: Unbalanced or unexpected parenthesis or bracket.
I tried creating a specific function but I'm not able to make it works.
Thanks!
  3 件のコメント
Luna
Luna 2019 年 7 月 18 日
What is Liv_dom_an? can you share the data and explain what kind of output you want to obtain?
Steven Lord
Steven Lord 2019 年 7 月 18 日
Mario Chiappelli: please don't make copies of MathWorks functions, especially where there's a way (as Akira Agata showed) to accomplish the task without doing so. That can lead to confusion where the modified function behaves differently than the unmodified function later on, after you've forgotten that you modified the function.

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

採用された回答

Akira Agata
Akira Agata 2019 年 7 月 18 日
How about the following?
retime(Liv_dom_an, 'monthly', @(x) median(x,'omitnan'))

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by