mean of cell array with different size

Hi every body
I have a matrix including cell array with different size (in row but with same column) how can I get the mean of each cell without for loop,
Thanks a lot for your help

댓글 수: 2

Daniel Shub
Daniel Shub 2013년 4월 21일
Why don't you want to use a for loop? The concept that loops in MATLAB are slow is very dated.
Oriane
Oriane 2016년 10월 10일
Thanks, I didn't know it has been optimized, I will check if there are some quick lectures about this kind of Matlab optimization, but have you some suggestion of good reading about that? (sorry for my English)

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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 4월 21일
편집: Azzi Abdelmalek 2013년 4월 21일

1 개 추천

out=cellfun(@mean,yourcellarray,'un',0)

댓글 수: 2

or
yourcellarray={[1 2;3 4;5 6], [10 20;30 40]}
out=cellfun(@(x)mean(x(:)),yourcellarray)
Oriane
Oriane 2016년 9월 23일
Hello, can you explain what it does please?

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

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2013년 4월 21일

댓글:

2016년 10월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by