MATLAB Answers

Multiple function handle in varfun

3 views (last 30 days)
Zeynab Mousavikhamene
Zeynab Mousavikhamene on 7 Dec 2019
Answered: Walter Roberson on 7 Dec 2019
I need to calculate the mean and STD of elements of table and the resulting table show me the mean and std in two columns next to each other. Here is the code I am using:
Tmean = varfun(@mean,T,'GroupingVariables',...
{'stor','s_method'},'InputVariables',{'ix','atfa','iss','aad'});
How can I add STD to Tmean? I dont want to make separate table for STD.

  0 Comments

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 7 Dec 2019
You can use @(v) [mean(v), std(v)] as the function, and splitvars() afterwards.

  0 Comments

Sign in to comment.

Sign in to answer this question.