How can I calculate average from specific rows to another rows in a datatable?
2 次查看(过去 30 天)
显示 更早的评论
Dear community
I'm trying to design a script, in order to calculate the average from the 1st to 3rd row, then from the 4th to 6th and finally from the 7th to 9th row. The data has this structure:
Comment Cell Temperature
24-04-2019 A8 38,76736069
24-04-2019 A8 38,70141602
24-04-2019 A8 39,03113937
24-04-2019 C5 38,56953049
24-04-2019 C5 39,29491806
24-04-2019 C5 39,26194382
24-04-2019 E1 36,5252533
24-04-2019 E1 36,6241684
24-04-2019 E1 36,36038971
The temperature are in the 6th column. These data are like datatable. I have this script:
Clean=table2cell(datatable);
nrow = height(datatable);
lastidx = floor(nrow/3) * 3;
T_p = mean(reshape(datatable{1:lastidx,6}, 3, []));
T_C=T_p.';
But doesn´t work. How can I do?
Any for loop?
Help please.
Thank U
6 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!