Effacer les filtres
Effacer les filtres

finding mean in 3D cell array

3 vues (au cours des 30 derniers jours)
HYZ
HYZ le 31 Août 2022
Modifié(e) : Matt J le 31 Août 2022
hi,
I have a cell B which is 2x3x2. B( :, :, 1) = A; B( :, :, 2) = A;
A = {[1,2,3, 4] [5,6,7,8] [9,10,11,12] ; [4,3,2,1] [8,7,6,5] [12,11,10,9]}
I wanted to average each element. the result cell array will be
C = {[2.5 2.5 2.5 2.5] [6.5 6.5 6.5 6.5] [10.5 10.5 10.5 10.5]}.
C will be 1x3x2 cell array.
Please suggest. thanks!

Réponse acceptée

Matt J
Matt J le 31 Août 2022
Modifié(e) : Matt J le 31 Août 2022
If you download mat2tiles, it is simply,
C=mat2tiles( mean(cell2mat(B),1) ,[1,4])

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by