Calculate Standard deviation in table
조회 수: 33 (최근 30일)
이전 댓글 표시
Hi,
I have a table with 20 columns, I want to make a new column with the standard deviation of each row from column 4 to 6.
So after column 6 i want to have a column with the stdev of all rows of column 4:6.
How can I do that?
댓글 수: 0
채택된 답변
Chunru
2021년 6월 25일
a = array2table(rand(5,8)) % Sample table
s = std(a{:, 4:6}, [], 2) % std along rows (dim=2)
b = [a table(s, 'VariableNames', {'std'})] % combine with original
추가 답변 (1개)
Erkan MSN
2022년 1월 24일
If you want to calculate the standard deviation of the whole table:
For example "cax" is table.
1.6424 5.2601 1.4691 0.7361 0.2771
1.0531 0.5722 1.8804 4.9636 0.9451
1.8084 1.6537 1.5916 0.8352 0.7740
0.7550 1.4221 1.7003 2.5646 0.4272
2.2935 2.5158 0.7656 1.0110 2.0810
1.0765 0.5390 1.9687 2.0829 0.4572
1.0493 1.4736 1.2810 1.0911 0.2073
2.1630 0.5679 2.8582 1.6006 0.4746
1.1625 0.7333 0.2623 0.6887 0.7897
2.9148 0.2886 3.1662 0.3645 0.5730
std(cax,[],'all')
ans =
1.0786e+03
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!