total mean of big amount of DATA in cell arrey
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi MATLABians
I have a cell with size of 10 * 25, and each array of this cell arrey include of different size of matrices like 31 * 38 (no matter). So i wanna take mean of this cell arrey, also wanna take total mean of each arrey of this cell and put it into an vector and then mean of the other arreys of this cell into that vec. And finally take the total mean of this vector. The result should be the total mean of the primary cell.
thank you for HELPing!
0 commentaires
Réponses (1)
Ameer Hamza
le 7 Nov 2020
following will calculate the mean of each cell seperately
C; % 10x25 cell array
C_means = cellfun(@(x) mean(x, 'all'), C)
However, note that since if you simply take the mean of C_means. It will not represent the mean of all elements since each cell has a matrix of different sizes. So you need a weighted average. For example
C; % 10x25 cell array
C_means = cellfun(@(x) mean(x, 'all'), C);
C_elements = cellfun(@numel, C);
C_mean_all = mean(C_means.*C_elements, 'all')/sum(C_elements, 'all')
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!