How to deal with this grpstat error message
Show older comments
Accepted Answer
More Answers (1)
Image Analyst
on 15 May 2022
You need to have braces around the average and sum, not brackets
{"average", "sum"}
4 Comments
String arrays are actually allowed there.
load patients
tbl = table(Gender,Age,Weight,Smoker);
tblstats = grpstats(tbl,["Gender","Smoker"],["mean","sum"],"DataVars","Weight")
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')
alpedhuez
on 15 May 2022
Categories
Find more on Repeated Measures and MANOVA 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!