Sum and Average of column in Matrix
2 views (last 30 days)
Show older comments
Rachael Courts
on 14 May 2019
Commented: madhan ravi
on 14 May 2019
I have a 27 x 34 table, which has different column headings such as 'start freq, end freq, and Duration90s'.
I'm wanting to calculate the sum and then the average of only one column. That being 'Duration90s'
I've tried: sum('Duration90s')
meandur = sum('Duration90s)/27
*27 indicates the number of entries
I have changed the code a few times but I keep receiving the sum = 1058
and the mean dur = 39.1852
However the correct answer should be sum = 14
and the mean dur = 0.518519
0 Comments
Accepted Answer
madhan ravi
on 14 May 2019
Edited: madhan ravi
on 14 May 2019
Wanted=T(:,'Duration90s');% here T is your table
% Google how to access data from table
sum(Wanted)
mean(Wanted)
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!