Access/calculate Matrices within a Cell Array

1 view (last 30 days)
Josef Ghebru
Josef Ghebru on 8 Apr 2021
Edited: Jan on 8 Apr 2021
I have a 51x13 cell array which contains 1x1 struct arrays and therein are many different matrices.
I want to calculate the mean of selected matrices of certain rows and columns in that cell array and save the results in one matrices.
My approach : Allmean= [mean(P{9:51,1}.selectedMatrice)]
with the Error form Matlab : "Expected one output from a curly brace or dot indexing expression, but there were 43 results"
Wich possibilitys there are? (maybe for loop?) How can I do that ?

Answers (1)

Jan
Jan on 8 Apr 2021
Edited: Jan on 8 Apr 2021
The desctiption of the data as text is less clear than posting some code, which produces example data.
With some guessing:
Allmean= mean([P{9:51,1}.selectedMatrice])
But I'm afraid this does not change the problem. Your data representation is extremely unuseful to perform calculations. Would it be possible to create a struct array instead of the cell array containing structs?

Categories

Find more on Structures in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!