How to deal with this grpstat error message
1 次查看(过去 30 天)
显示 更早的评论
0 个评论
采纳的回答
the cyclist
2022-5-15
I think you want to use "mean" instead of "average" for the summary statistic.
更多回答(1 个)
Image Analyst
2022-5-15
You need to have braces around the average and sum, not brackets
{"average", "sum"}
4 个评论
the cyclist
2022-5-15
编辑:the cyclist
2022-5-15
It's easy to get muddled, because if you specify the input arguments as character arrays rather than strings, then you do need to use curly braces. (Notice the single quotes rather than the double quotes around the arguments.)
load patients
tbl = table(Gender,Age,Weight,Smoker);
tblstats = grpstats(tbl,{'Gender','Smoker'},{'mean','sum'},'DataVars','Weight')
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!