Problem with sum in cell
1 回表示 (過去 30 日間)
古いコメントを表示
Hi everyone i have a 5x2000x5 cell and i want to take the mean over it in the following way:
when i take yf= (y{1,1000,1}+y{2,1000,1}+y{3,1000,1}+y{4,1000,1}+y{5,1000,1})/5 for example i get what i want which is the mean over the first index y{i,1000,1} while keeping the second and third index constant.
But when i try to do this with the next command y=(y{mean(n),1000,1}) or even y = (y{sum(n),1000,1})/5 I get a different result.
Does anyone know how can i do this correctly without having to type manually all the values?
(The sizes in the cells are 1x99 double).
2 件のコメント
採用された回答
Voss
2022 年 4 月 7 日
y = repmat({randn(1,99)},5,2000,5); % making a cell array like yours
yf = mean(vertcat(y{:,1000,1}),1) % performing the mean like you want to do
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!