How can I compute the mean of a cell matrix with different size ?

조회 수: 3 (최근 30일)
Ashkan Rigi
Ashkan Rigi 2022년 4월 29일
댓글: Jan 2022년 4월 29일
Hi everybody. I have a matrix array (2dimensional) and I would like to compute the mean of each coulumn.
R{i,j}=cell array with 186*157 size. i=1:186,j=1:157.
  댓글 수: 1
Jan
Jan 2022년 4월 29일
What is the contents of the cell elements? Do you want to get the mean value of the elements, or between the elements?

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2022년 4월 29일
Try something like this —
R = {rand(10,8)}
R = 1×1 cell array
{10×8 double}
Rmeanc = cellfun(@mean,R, 'Unif',0)
Rmeanc = 1×1 cell array
{[0.4739 0.5144 0.6163 0.5387 0.4090 0.5248 0.3688 0.3456]}
Rmeanv = Rmeanc{:}
Rmeanv = 1×8
0.4739 0.5144 0.6163 0.5387 0.4090 0.5248 0.3688 0.3456
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by