フィルターのクリア

cells: How to take Mean over same-indexed elements across Cells?

2 ビュー (過去 30 日間)
adam
adam 2014 年 4 月 28 日
回答済み: Andrei Bobrov 2014 年 4 月 28 日
I have a cell array of 53 different (40,000 x 2000) sparse matrices. I need to take the mean over the third dimension, so that for example element (2,5) is averaged across the 53 cells. This should yield a single (33,000 x 2016) output. I think there ought to be a way to do this with cellfun(), but I am not able to write a function that works across cells on the same within-cell indices.

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2014 年 4 月 28 日
A = arrayfun(@(x)randi(20,5 ,9),(1:4)','un',0); % your cell array
out = mean(cat(3,A{:}),3);

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by