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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!