How to find mean of cell array

4 vues (au cours des 30 derniers jours)
ANUSAYA SWAIN
ANUSAYA SWAIN le 27 Mar 2023
Commenté : the cyclist le 27 Mar 2023
I have an cell array (h) of 4X1. Inside the cell I have 4 matrices each of size 234X64X8. How to find mean of each matrix using mean(h,3)
  1 commentaire
Image Analyst
Image Analyst le 27 Mar 2023
The mean of a 3-D matrix along dimension 3 would be a 234X64 matrix. So for each of the cells in the 4 element cell array, you say you have 4 of those matrixes, for a total of 16 2-D matrices.
How do you have 4 matrices inside each cell? You can have only one matrix, unless each cell contains a 4 element cell array. So let's say you did, then for each of the cell array's 4 cells you would have 4 matrices (since each of the cells in the cell array somehow contains 4 3-D matrices). This would give a grand total of 16 234x64 matrices. Is that right? What do you want as the output to be?
If you want any more help, say what you want as the output, and attach your cell array in a .mat file with the paperclip icon. But after you read this:

Connectez-vous pour commenter.

Réponses (1)

the cyclist
the cyclist le 27 Mar 2023
Here is one way:
cellfun(@(x)mean(x,3),h,'UniformOutput',false)
  1 commentaire
the cyclist
the cyclist le 27 Mar 2023
To clarify, after @Image Analyst's comment ...
My solution assumes that you have one 3-dimensional array in each of your 4 cell elements. (That was how I interpreted your remark that you have 4 matrices.)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Cell Arrays 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!

Translated by