total mean of big amount of DATA in cell arrey
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Ameer Hamza
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!