How do I use the "omitnan' option for the Mean function when calling the function using the splitapply function?

89 views (last 30 days)
I would like to use the following command: splitapply(@mean,MyArray,G) but call the @mean function using the "omitnan" option. How can I do that? In this example, MyArray is the array that I would like to apply the mean function to after I have split it into Groups dictated by the G vector

Accepted Answer

Star Strider
Star Strider on 24 Feb 2020
One option:
splitapply(@(x)mean(x,'omitnan'),MyArray,G)
  6 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Just for fun in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!