How to determine number of patients in the category
3 views (last 30 days)
Show older comments
I am trying to determine how many patients fall into each BMI class and each blood pressure class. Like how many patients are "Normal", how many are "Overweight", etc. and how many have normal bp or high bp, etc. Here is the table I have formulated. It is named data_table. I am stuck on how to count the patients.
0 Comments
Answers (2)
Voss
on 17 Mar 2025
data_table = table([1;2;3;4;5;6],[24;26;25;28;27;26],["Underweight";"Optimal";"Obese";"Obese";"Obese";"Optimal"],["Low";"Normal";"Normal";"Pre Hypertension";"Stage 1 Hypertension";"Normal"],'VariableNames',{'ID','Age','BMI Class','Blood Pressure Class'})
result = groupcounts(data_table,{'BMI Class','Blood Pressure Class'})
Reference:
These may also be useful:
0 Comments
Star Strider
on 17 Mar 2025
Try something like this —
imshow(imread('Screenshot 202....55.14 PM.png'))
BMIC = ["Underweight","Optimal","Obese"];
T = table(Size =[10,1], VariableTypes={'string'}, VariableNames={'BMI Class'});
T.('BMI Class') = BMIC(randi(3,10,1)).'
[Cu,~,idx] = unique(T.('BMI Class'))
Tally = accumarray(idx, ones(size(idx)))
Result = table(Cu,Tally)
.
0 Comments
See Also
Categories
Find more on Structures 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!