How to calculate mean across the elements of a cellarray?

조회 수: 7 (최근 30일)
DEEPAK PHCSFI17041149
DEEPAK PHCSFI17041149 2017년 12월 28일
답변: Image Analyst 2017년 12월 28일
I have a cellarray A of dimension 64x8 with elements in the following dimension,
520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double
520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double
520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double 520x1 double
...............
Now i need to take MEAN across the 8 rows in each column, so that i will get just one 520x1 cell per row.
so, after applying mean across rows, my output should be something like,
520x1 double
520x1 double
520x1 double
520x1 double
520x1 double
520x1 double
............
............
So, my output would be a 64x1 cell array transformed from 64x8.
i tried with doing this with the following command,
avgCell = {mean(cat(3,C{:}),3)}
But, it gives 1x1 cell array with just one cell of dimension 520x1.
Kindly correct me, and suggest me if there is any function to deal with this.

답변 (1개)

Image Analyst
Image Analyst 2017년 12월 28일
Try using cell2mat(), then mean(). Attach your cell array in a .mat file with the paper clip icon if you can't figure it out.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by