Mean and Standard deviation table
조회 수: 17 (최근 30일)
이전 댓글 표시
I have a table "cal_table" and it looks like this:
I would like to find the mean and standard deviation of each 'cal0_05mM', 'cal0_03mM', ..., 'cal0_50mM' by teh three 'Rep'. What is the quickest way to do it?
Thank you very muuch.
댓글 수: 0
채택된 답변
Image Analyst
2022년 8월 20일
편집: Image Analyst
2022년 8월 20일
m = reshape(cal_table.Var2, 3, []); % Get 3-by-5 matrix.
means = mean(m, 1) % Get means of each column
sds = std(m, 1) % Get standard deviations
댓글 수: 0
추가 답변 (1개)
the cyclist
2022년 8월 20일
댓글 수: 1
the cyclist
2022년 8월 20일
편집: the cyclist
2022년 8월 20일
To be more specific, you can do the one-liner
groupsummary(cal_table,Var1,["mean","std"])
Here is an example, related to the one in the documentation:
% Some data
Gender = ["male";"female";"female";"male";"male"];
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
T = table(Gender,Age,Height,Weight)
% Get the mean and std
groupsummary(T,"Gender",["mean","std"])
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!