フィルターのクリア

Averaging multiple cells together

19 ビュー (過去 30 日間)
AJ
AJ 2012 年 10 月 26 日
I apologize if this is a simple question, but I was wondering if there was a way to create a new cell that contained the average of the numeric values of multiple other cells so that the numeric values were only averaged with other values in the same location across the cells (for example 5 found in row 1 column 2 in cell 1 will only be averaged with other numbers in other cells that are in row 1 column 2). If it helps, I have 5 cells that each have parameters of 3000x4. Thank you.
  2 件のコメント
Matt J
Matt J 2012 年 10 月 26 日
編集済み: Matt J 2012 年 10 月 26 日
If the parameter matrices are all the same size (3000x4), why are you holding them in cells? Why not as a 3000x4x5 array? This would make the operations you're trying to do trivially easy (see my further comments below).
Image Analyst
Image Analyst 2012 年 10 月 26 日
Excellent point. Never mess around with cell arrays when you don't have to - they always add a layer of complications, e.g. do I use parentheses of braces, etc.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2012 年 10 月 26 日
avgCell = {mean(cat(3,yourcell{:}),3)}
  1 件のコメント
Matt J
Matt J 2012 年 10 月 26 日
If you had held this as a 3000x4x5 array, A, this would have been as simple as
avg=mean(A,3);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by