total mean of big amount of DATA in cell arrey
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Ameer Hamza
el 7 de Nov. de 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 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!