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
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
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
2013년 4월 21일
편집: Azzi Abdelmalek
2013년 4월 21일
out=cellfun(@mean,yourcellarray,'un',0)
댓글 수: 2
Azzi Abdelmalek
2013년 4월 21일
or
yourcellarray={[1 2;3 4;5 6], [10 20;30 40]}
out=cellfun(@(x)mean(x(:)),yourcellarray)
Oriane
2016년 9월 23일
Hello, can you explain what it does please?
카테고리
도움말 센터 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!