How to average certain columns in a matrix
10 ビュー (過去 30 日間)
古いコメントを表示
I have a 107x16 matrix, the first column is time data, the last 15 are data points. I'd like to average the 15 data columns and collapse this matrix into a 107x2 matrix of time and average data.
Thank you!
0 件のコメント
採用された回答
madhan ravi
2021 年 7 月 2 日
編集済み: madhan ravi
2021 年 7 月 2 日
matrix = rand(107, 16);
Matrix = [matrix(:, 1), mean(matrix(:, 2 : end), 2)];
size(Matrix)
0 件のコメント
その他の回答 (1 件)
madhan ravi
2021 年 7 月 2 日
T = array2table(rand(2, 3))
T = [T(:, 1), array2table(mean(T{:, 2 : end}, 2), 'V', {'AVERAGE'})] % where Var1 is the time data
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!