Mean of each Value in a Cell Array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Fabio Taccaliti
am 8 Jul. 2022
Kommentiert: Voss
am 8 Jul. 2022
Hello,
I havea cell A (107x3), with each 14x8 double.
I want to create a cell A_mean 1x3 that just contain three 14x8 doubles, that are the mean of all the value.
I mean, A_mean{1,1}(1,1) should be the mean(A{1,1}(1,1),A{2,1}(1,1)...A{107,1}(1,1)), and the same for all the others numbers.
I really don't know how can I do it..
Thanks in advance :)
0 Kommentare
Akzeptierte Antwort
Voss
am 8 Jul. 2022
% a cell A (107x3), with each 14x8 double
A = arrayfun(@(~)randn(14,8),zeros(107,3),'UniformOutput',false)
% I want to create a cell A_mean 1x3 that just contain three
% 14x8 doubles, that are the mean of all the value
N = size(A,2);
A_mean = cell(1,N);
for ii = 1:N
A_mean{ii} = mean(cat(3,A{:,ii}),3);
end
disp(A_mean);
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!