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 Kommentare

Daniel Shub
Daniel Shub am 21 Apr. 2013
Why don't you want to use a for loop? The concept that loops in MATLAB are slow is very dated.
Oriane
Oriane am 10 Okt. 2016
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)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 21 Apr. 2013
Bearbeitet: Azzi Abdelmalek am 21 Apr. 2013

1 Stimme

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

2 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 21 Apr. 2013

Kommentiert:

am 10 Okt. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by