How to calculate mean across the elements of a cell?

I have a 7 x 1 cell(attached) with elements in the following dimensions
I want to calcuate the mean across seven rows so my output will be one row of dimension 100x1. Can you help please?

 Accepted Answer

Jan
Jan on 21 Feb 2022
Edited: Jan on 21 Feb 2022
Cells are a really bad way to store data, if you want to perform calculations with them. Simply convert them to a numerical array:
data = cat(2, YourCell{:});
result = mean(data, 2); % Now it's easy

4 Comments

Jan
Jan on 22 Feb 2022
Edited: Jan on 22 Feb 2022
@Tomaszzz: There have been another question from you, which vanished during I posted a solution. Did you delete it? Did you found the problem "for k = length()" instead of the needed "for k = 1:length()" by your own?
Hi Jan. Yes, I deleted it. I typed 'filter' instead of 'filtfilt' and changing it solved the issue. What you say, is the second mistake I realized there was. Apologies for deleting the question too early.
Okay. Thanks for the explanation.

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 21 Feb 2022

Commented:

Jan
on 22 Feb 2022

Community Treasure Hunt

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

Start Hunting!