How to average certain columns in a matrix
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gregory Manoukian
le 2 Juil 2021
Réponse apportée : madhan ravi
le 2 Juil 2021
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 commentaires
Réponse acceptée
madhan ravi
le 2 Juil 2021
Modifié(e) : madhan ravi
le 2 Juil 2021
matrix = rand(107, 16);
Matrix = [matrix(:, 1), mean(matrix(:, 2 : end), 2)];
size(Matrix)
0 commentaires
Plus de réponses (1)
madhan ravi
le 2 Juil 2021
T = array2table(rand(2, 3))
T = [T(:, 1), array2table(mean(T{:, 2 : end}, 2), 'V', {'AVERAGE'})] % where Var1 is the time data
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!